Help with my Questionaire Program
hii guys, i am new to c++ and i wrote this basic program but i cant seem to make it work right. Here is the code:-
Code:
// questionaire.cpp
#include <iostream>
#include <string.h>
using namespace std;
const int ANS = 80;
int main()
{
char choice = 'x';
char Answer[ANS];
cout << "\nQ1. What is the capital of Turkey?";
cout << "\n My Answer is:- ";
cin >> Answer[ANS];
if( Answer == "Ankara" || "ankara" )
cout << "You got the right answer!";
else
cout << "The answer is wrong.";
cout << "\nQ2. What is the capital of Egypt?";
cout << "\n My Answer is:- ";
cin >> Answer[ANS];
if( Answer == "Cairo" || "cairo")
cout << "You got the right answer!";
else
cout << "The answer is wrong.";
cout << "\nQ3. What is the capital of Iraq?";
cout << "\n My Answer is:- ";
cin >> Answer[ANS];
if( Answer == "Baghdad" || "baghdad")
cout << "You got the right answer!";
else
cout << "The answer is wrong.";
}
What i want it to do is make it go to the next question if the user types in the right answer, for example, if the person types "Ankara", or "ankara" for the first question it goes directly to the next question, or if the question is wrong, it says "please try again" and goes back to the question again. But after 3 tries and the user cannot answer the question, then it finally goes to the next. you guys understand me?? thanks a lot