if (input == "exit") {return 0;}
last_names[rand()%length]; //where length= length of the array
if (input == first_names[index]) {//display the "correct message"
} else {//display the "wrong message"
|
|
string Capital[]= {"Austria", "Belgium", "Bulgaria", "Cyprus", "Czech Republic"}
(a)Randomly displays one of the above capital cities and prompts the user to type in the country of which it is a capital. (b) If the user types in a correct answer the program should display “Correct Answer!” and exit. (c) If the user types in a wrong answer, the program should display the correct answer and repeat step (a). (d) If the user types in the word exit, the program should exit. |
|
|
|
|
|
|
1> : error C2146: syntax error : missing ';' before identifier 'string' 1>: error C2146: syntax error : missing ';' before identifier 'Capital' 1> : error C2275: 'std::string' : illegal use of this type as an expression 1> : see declaration of 'std::string' 1> : error C2065: 'Capital' : undeclared identifier 1> : error C2059: syntax error : '{' 1> : error C2143: syntax error : missing ';' before '{' 1> : error C2143: syntax error : missing ';' before '}' 1> : error C2065: 'Capital' : undeclared identifier 1> : error C2065: 'Capital' : undeclared identifier 1> : error C2059: syntax error : '}' 1> : fatal error C1075: end of file found before the left brace '{' at 'c:\users\david\documents\visual studio 2008\projects\a1q4\a1q4\a1q41.cpp(9)' was matched 1>a1q4 - 11 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== |
|
|
1> error C2059: syntax error : '}' 1> fatal error C1075: end of file found before the left brace '{' at 'c:\users' was matched 1> - 2 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== |
|
|
|
|
cout << Country[index] << "is the capital of" <<Capital[index]<<//will this line bring up the correct capital?
cout << Country[index] << "is the capital of" <<Capital[index]<<//will this line bring up the correct capital?
fatal error C1075: end of file found before the left brace '{' at |
|
|
return 0;
|
|