私はプログラミングにかなり慣れていません。私は理解できないこのエラーに遭遇しました。スコアを入力できるはずです。配列に事前に入力された情報を使用して、その成績を取得した学生の数を教えてくれます。
私が得るエラーメッセージは次のとおりです。
1>------ Build started: Project: Ch11_27, Configuration: Debug Win32 ------
1>Build started 4/4/2013 1:17:26 PM.
1>InitializeBuildStatus:
1> Touching "Debug\Ch11_27.unsuccessfulbuild".
1>ClCompile:
1> main.cpp
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl checkScore(int * const,int * const)" (?checkScore@@YAXQAH0@Z) referenced in function _main
1>F:\a School Stuff TJC Spring 2013\Intro Prog\C++ Projects\Ch11_27\Debug\Ch11_27.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.
これが私のコードです:
//Advanced27.cpp - displays the number of students
//earning a specific score
//Created/revised by <your name> on <current date>
#include <iostream>
using namespace std;
//Function Prototypes
void checkScore( int scores[], int storage[]);
int main()
{
//declare array
int scores[20] = {90, 54, 23, 75, 67, 89, 99, 100, 34, 99,
97, 76, 73, 72, 56, 73, 72, 20, 86, 99};
int storage[4] = {0};
char answer = ' ';
cout << "Do you want to check a grade? (Y/N): ";
cin >> answer;
answer = toupper(answer);
while (answer = 'Y')
{
checkScore(scores, storage);
cout << "Do you want to check a grade? (Y/N): ";
cin >> answer;
answer = toupper(answer);
}
system("pause");
return 0;
} //end of main function
//*****Function Defenitions*****
void checkGrade(int scores[], int storage[])
{
int temp = 0;
int earnedScore = 0;
cout << "Enter a grade you want to check: ";
cin >> earnedScore;
for (int sub = 0; sub <= 20; sub +=1)
{
if (scores[sub] = earnedScore)
{
storage[temp] += 1;
}
}
}