我正在编写一个程序来搜索一系列素数,大约进行到一半以检查我的进度,我决定构建它以确保一切正常,我不断收到错误 LNK2019!它说这是一个未解决的外部问题。我做了一些研究,但我对任何事情都不太了解。这是代码。
#include <iostream>
using namespace std;
int singlePrime(int subjectNumber);
int main() {
cout<<"Would you like to find a single prime number(1), or a range(2)?"<<endl;
int methodchoice;
cin>>methodchoice;
if(methodchoice ==1) {
int subjectNumber;
cout<<"Which number would you like to test for primeness?"<<endl;
cin>>subjectNumber;
int singlePrime(subjectNumber);
}
if(methodchoice==2) {
int lowRange;
int highRange;
cout<<"Input the low value for your range."<<endl;
cin>> lowRange;
cout<<"Input the high value for your range"<<endl;
cin>> highRange;
for (int index=lowRange; index<highRange;index++) {
if (index=highRange) {
break;
}
singlePrime(index);
}
}
}