반환 유형이없는 함수를 호출하려고하는데 호출되는 것 같지 않습니다.C++에서 함수 호출
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int ItemsInQuestion[4];
void GetQuestions(int NumQuests);
int main()
{
int NumberOfQuestions = 0;
srand((unsigned)time(NULL));
cout << "How many questions would you like?" << endl;
cin >> NumberOfQuestions;
cout << NumberOfQuestions << " questions will be asked.";
GetQuestions(NumberOfQuestions);
system ("PAUSE");
return 0;
}
void GetQuestions(int NumQuests)
{
for(int Questions=NumQuests; Questions>NumQuests; Questions++)
{
ItemsInQuestion[0]=(rand()%(263))+1;
ItemsInQuestion[1]=(rand()%(263))+1;
ItemsInQuestion[2]=(rand()%(263))+1;
ItemsInQuestion[3]=(rand()%(263))+1;
cout << ItemsInQuestion[0] << ' ' << ItemsInQuestion[1] << ' ' <<ItemsInQuestion[2] << ' ' << ItemsInQuestion[3];
}
}
배열의 값을 출력 라인은 결코 등장하지 :
코드 (요약)이 같이 보입니다. 이 원인은 무엇입니까?
관련없는 있지만, 건설적인 조언으로 : 디버거를 사용하십시오. 디버거를 사용합니까? :-) 그런 경우에는 함수를 단계별로 살펴보고 함수가 호출되었지만 for 루프는 건너 뛴다는 것을 알 수 있습니다. – TobiMcNamobi