你好,请帮我我已经尝试了一些解决方案,但它无法修复它。
我做了这样的事情,出现了致命的错误LNK1120:1未解决的外部。
**source code:**
#include<iostream>
#include<ctime>
#include<cstdlib>
using namespace std;
//Tabel Data Hubungan Antara Energi Radiasi Gamma dengan Koefisien Atenuasi Fotolistrik Bahan Aktif Argon
double tabel_Ar[81][2]={{1.00E-03,3.18E+03},{1.50E-03,1.10E+03},{2.00E-03,5.09E+02},{3.00E-03,1.68E+02},{3.20E-03,1.40E+02},{3.20E-03,1.27E+03},
{4.00E-03,7.55E+02},{5.00E-03,4.21E+02},{6.00E-03,2.58E+02},{8.00E-03,1.17E+02},{1.00E-02,6.23E+01},{1.50E-02,1.93E+01},{2.00E-02,8.21E+00},
{3.00E-02,2.40E+00},{4.00E-02,9.91E-01},{5.00E-02,4.95E-01},{6.00E-02,2.79E-01},{8.00E-02,1.13E-01},{1.00E-01,5.56E-02},{1.50E-01,1.54E-02},
{2.00E-01,6.28E-03},{3.00E-01,1.82E-03},{4.00E-01,7.98E-04},{5.00E-01,4.35E-04},{6.00E-01,2.72E-04},{8.00E-01,1.38E-04},{1.00E+00,8.59E-05},
{1.02E+00,8.12E-05},{1.25E+00,5.50E-05},{1.50E+00,3.98E-05},{2.00E+00,2.47E-05},{2.04E+00,2.39E-05},{3.00E+03,1.36E-05},{4.00E+00,9.20E-06},
{5.00E+00,6.92E-06},{6.00E+00,5.53E-06},{7.00E+00,4.60E-06},{8.00E+00,3.94E-06},{9.00E+00,3.44E-06},{1.00E+01,3.05E-06},{1.10E+01,2.74E-06},
{1.20E+01,2.49E-06},{1.30E+01,2.28E-06},{1.40E+01,2.10E-06},{1.50E+01,1.81E-06},{1.60E+01,1.60E-06},{1.80E+01,1.43E-06},{2.00E+01,1.29E-06},
{2.20E+01,1.18E-06},{2.40E+01,1.08E-06},{2.60E+01,9.99E-07},{2.80E+01,9.30E-07},{3.00E+01,6.89E-07},{4.00E+01,5.48E-07},{5.00E+01,4.54E-07},
{6.00E+01,3.39E-07},{1.00E+02,2.70E-07},{1.50E+02,1.79E-07},{2.00E+02,1.34E-07},{3.00E+02,8.92E-08},{4.00E+02,6.68E-08},{5.00E+02,5.34E-08},
{6.00E+02,4.45E-08},{8.00E+02,3.34E-08},{1.00E+03,2.67E-08},{1.50E+03,1.78E-08},{2.00E+03,1.33E-08},{3.00E+03,8.88E-09},{4.00E+03,6.66E-09},
{5.00E+03,5.33E-09},{6.00E+03,4.44E-09},{8.00E+03,3.33E-09},{1.00E+04,2.66E-09},{1.50E+04,1.78E-09},{2.00E+04,1.33E-09},{3.00E+04,8.88E-10},
{4.00E+04,6.66E-10},{5.00E+04,5.33E-10},{6.00E+04,4.44E-10},{8.00E+04,3.33E-10},{1.00E+05,2.66E-10}};
//Tabel Data Hubungan Antara Energi Radiasi dengan Koefisien Atenuasi Fotolistrik Bahan Aktif NaI
double tabel_NaI[95][2]={{1.00E+00,7.79E+06},{1.04E+00,7.25E+06},{1.07E+00,6.74E+06},{1.07E+00,7.02E+06},{1.07E+00,7.93E+06},{1.07E+00,7.02E+06},
{1.07E+00,7.92E+06},{1.50E+00,3.80E+06},{2.00E+00,1.92E+06},{3.00E+00,7.00E+05},{4.00E+00,3.35E+05},{4.56E+00,2.39E+05},{4.56E+00,6.59E+05},
{4.70E+00,6.17E+05},{4.85E+00,5.77E+05},{4.85E+00,7.72E+05},{5.00E+00,7.28E+05},{5.19E+00,6.61E+05},{5.19E+00,7.60E+05},{6.00E+00,5.30E+05},
{8.00E+00,2.49E+05},{1.00E+01,1.38E+05},{1.50E+01,4.57E+04},{2.00E+01,2.06E+04},{3.00E+01,6.61E+03},{3.32E+01,4.97E+03},{3.32E+01,2.98E+04},
{4.00E+01,1.82E+04},{5.00E+01,1.01E+04},{6.00E+01,6.11E+03},{8.00E+01,2.75E+03},{1.00E+02,1.46E+03},{1.50E+02,4.59E+02},{2.00E+02,2.02E+02},
{3.00E+02,6.48E+01},{4.00E+02,2.99E+01},{5.00E+02,1.68E+01},{6.00E+02,1.08E+01},{8.00E+02,5.59E+00},{1.00E+03,3.49E+00},{1.02E+03,3.32E+00},
{1.25E+03,2.24E+00},{1.50E+03,1.60E+00},{2.00E+03,9.76E-01},{2.04E+03,9.42E-01},{3.00E+03,5.18E-01},{4.00E+03,3.43E-01},{5.00E+03,2.54E-01},
{6.00E+03,2.00E-01},{7.00E+03,1.65E-01},{8.00E+03,1.40E-01},{9.00E+03,1.21E-01},{1.00E+04,1.07E-01},{1.10E+04,9.57E-02},{1.20E+04,8.65E-02},
{1.30E+04,7.89E-02},{1.40E+04,7.25E-02},{1.50E+04,6.71E-02},{1.60E+04,6.24E-02},{1.80E+04,5.47E-02},{2.00E+04,4.87E-02},{2.20E+04,4.39E-02},
{2.40E+04,4.00E-02},{2.60E+04,3.67E-02},{2.80E+04,3.39E-02},{3.00E+04,3.15E-02},{4.00E+04,2.32E-02},{5.00E+04,1.84E-02},{6.00E+04,1.52E-02},
{8.00E+04,1.13E-02},{1.00E+05,9.00E-03},{1.50E+05,5.96E-03},{2.00E+05,4.46E-03},{3.00E+05,2.96E-03},{4.00E+05,2.22E-03},{5.00E+05,1.77E-03},
{6.00E+05,1.47E-03},{8.00E+05,1.11E-03},{1.00E+06,8.83E-04},{1.50E+06,5.89E-04},{2.00E+06,4.41E-04},{3.00E+06,2.94E-04},{4.00E+06,2.21E-04},
{5.00E+06,1.76E-04},{6.00E+06,1.47E-04},{8.00E+06,1.10E-04},{1.00E+07,8.82E-05},{1.50E+07,5.88E-05},{2.00E+07,4.41E-05},{3.00E+07,2.94E-05},
{4.00E+07,2.20E-05},{5.00E+07,1.76E-05},{6.00E+07,1.47E-05},{8.00E+07,1.10E-05},{1.00E+08,8.82E-06}};
//Densitas Material yang Digunakan
struct sdensitas{char material[15]; double rho;};
sdensitas tabel_material[2]={{"NaI", 3.67},{"Ar", 1.784}};
//==========================================================SUB_PROGRAM=========================================================================//
//Sub Program Menghitung Nilai PR
double probabilitas()
{
double PR;
srand((unsigned int)time(NULL));
return PR= 1.0*((double)(rand()+time(NULL)%100))/100;
}
//Sub Program Interpolasi
double y(double x1, double y1, double x2, double y2, double x)
{
return y1+(y2-y1)/(x2-x1)*(x-x1);
}
//Sub Program Membaca Table
//Membaca Tabel 2 Kolom
void baca(double m[][2], int jklm, char teks[25], double& E, double& atenuasi, int&kolom)
{
int k;
//input data
do{
cout<<"Masukan Nilai Energi Radiasi= "<<teks<<"= "; cin>>E;
} while (E<m[0][0]||E>m[jklm-1][0]);
for(k=0; k<(jklm-1); k++)//baca Energy
{
if(E>=m[k][0]&&E<=m[k+1][0])
{
atenuasi=y(m[k][0], m[k][1], m[k+1][0], m[k+1][1], E); break;
}
}
kolom=k;
}
//Membaca Tabel Ar dan NaI
void baca_tabel(int pilihan, int& kolom, double E, double atenuasi, double En, double At)
{
int kolo;
system("cls");
cout<<"Input Besar Energi Radiasi Gamma yang Digunakann"
<<"==================================================";
switch (pilihan)
{
case 0:
{
baca(tabel_Ar, 81,"Energi Radiasi Gamma yang Digunakan", E, atenuasi, kolom);
} break;
case 1:
{
baca(tabel_NaI, 95, "Energi Radiasi Gamma yang Digunakan", En, At, kolo);
} break;
}
}
//Menghitung Panjang Lintasan Radiasi
void hitung(double PR,double& atenuasi, double& At, double& rho)
{
double x, nue;
nue=atenuasi=At;
x=-log(1-PR)/nue*rho;
}
//menghitung Intensitas Radiasi Hasil Interaksi Fotolistrik
void I(double& Io, double& PR)
{
double I;
I=Io*PR;
}
//Menghitung Efisiensi Detektor
void efisiensi(double& Io, double& I)
{
double Eff;
Eff=I/Io;
}
//Memasukan Input Data yang Dibutuhkan
void input()
{
int PD, BA, Io, Ein;
cout<<"nttPROGRAM PENGHITUNG EFISIENSI DETEKTOR RADIASI GAMMA"
<<"nt============================================================"
<<"nKeterangan: "
<<"n1. Efisiensi detektor adalah fungsi geometri detektor."
<<"n2. Efisiensi detektor adalah fungsi koefisien atenuasi interaksi fotolistrik."
<<"n3. Efisiensi detektor adalah fungsi densitas material aktif detektor"
<<"n4. Efisiensi detektor adalah fungsi material aktif yang digunakan detektor.";
cout<<"ntMasukan Input Perhitungan:";
cout<<"nt 1. Masukan Besar Energi Radiasi yang Digunakan= "; cin>>Ein;
cout<<"nt 2. Panjang Detektor yang Digunakan= "; cin>>PD;
cout<<"nt 3. Bahan Aktif yang Digunakan= "; cin>>BA;
cout<<"nt 4. Intensitas Awal Radiasi= "; cin>>Io;
}
//Menampilkan Hasil
int tampilkan_hasil(int pilihan, double E, double PR, double rho, int Io, double I, double x, double s, double Eff)
{
system ("cls");
cout<<"ntHasil Pembacaan Tabel dan Hasil Perhitungan"
<<"nt============================================n";
switch (pilihan)
{
case 0:
{
cout<<"Energi Radiasi yang Diguanakan= "<<E;
cout<<"Peluang Interaksi Fotolistrik Antara Radiasi Gamma dengan Material Aktif, PR= "<<PR<<endl;
cout<<"Panjang Lintasan Radiasi= "<<x<<" cm"<<endl;
cout<<"Panjang Aktif Detektor= "<<s<<" cm"<<endl;
cout<<"Densitas Bahan Aktif, rho= "<<rho<<" g/cm3"<<endl;
cout<<"Intensitas Awal Radiasi= "<<Io<<" photon/cm2.s"<<endl;
cout<<"Hasil Cacah Intensitas Radiasi= "<<I<<" photon/cm2.s"<<endl;
}break;
case 1:
{
cout<<"Peluang Interaksi Fotolistrik Antara Radiasi Gamma dengan Material Aktif, PR= "<<PR<<endl;
cout<<"Panjang Lintasan Radiasi= "<<x<<" cm"<<endl;
cout<<"Panjang Aktif Detektor= "<<s<<" cm"<<endl;
cout<<"Densitas Bahan Aktif, rho= "<<rho<<" g/cm3"<<endl;
cout<<"Intensitas Awal Radiasi= "<<Io<<" photon/cm2.s"<<endl;
cout<<"Hasil Cacah Intensitas Radiasi= "<<I<<" photon/cm2.s"<<endl;
} break;
}
if(x<=s)
{
cout<<"Terjadi Interaksi";
cout<<"Effisiensi Detektor adalah= "<<Eff<<endl;
}
else
{
cout<<"Tidak Terjadi Interaksi";
}
cout<<"Effisiensi Detektor adalah= "<<Eff<<endl;
system("pause");
return 0;
}
and the output:
1>------ Build started: Project: COBATUGAS2, Configuration: Debug Win32 ------
1>Build started 25/09/2014 1:16:59.
1>PrepareForBuild:
1> Creating directory "E:Komputasi NuklirCOBATUGAS2Debug".
1>InitializeBuildStatus:
1> Creating "DebugCOBATUGAS2.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>ClCompile:
1> X.cpp
1>MSVCRTD.lib(crtexe.obj) : `error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup`
1>E:Komputasi NuklirCOBATUGAS2DebugCOBATUGAS2.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:02.87
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
你能告诉我怎么修吗?
在操作系统中运行的每个C++程序都必须具有入口点函数main。你的眼睑没有这样的功能。
来自C++标准(3.6.1主要功能)
1程序应包含一个名为main的全局函数,该函数是程序的指定启动