| لعبة الأسئلة |

Mahmod Koki and khaled Tawami

Question game | لعبة الأسئلة

Code Jam 2 | لعبة وكود 2

Khaled Tawami | Mahmod koki

#include <iostream>

using namespace std;

int main()

{

string N;

 int A;

 cout << "Welcome to the game..\n";

 cout << "\n";

 cout << "(P1)Enter your name:"<<endl;

 cin  >> N;

 cout << "(P1)Enter your age:"<<endl;

 cin  >> A;

  if (A>=11)

{

 cout <<"Good luck :) "<<endl;

}

 else

{

 cout << "You are young :("<<endl;

}

    char t;

    int O, x;

    int math[6];

    int history[6];

    int Sport[6];

    int score = 0;

    cout << "Choose one question:" << endl;

    cout << "1.Math" << endl;

    cout << "2.History" << endl;

    cout << "3.Sport" << endl;

    cin >> x;

    for (;;)

    {

        if (score == -3)

        {

            cout << "Game over" << endl;

            cout << "Your score is:" << score << endl;

            break;

        }

        if (x == 1)

        {

            cout << "Choose between 1 ---> 6" << endl;

            cin >> O;

            if (O == 1)

            {

                cout << " What 19x6= ?" << endl;

                cout << " The answer is : " << endl;

                cin >> math[0];

                if (math[0] == 114)

                {

                    cout << "Thats Correct ;)" << endl;

                    score++;

                    cout << "Your score is:" << score << endl;

                }

                else

                {

                    cout << "Wrong answer :(" << endl;

                    cout << "The answer is: 114" << endl;

                    score--;

                    cout << "Your score is:" << score << endl;

                }


            }

            if (O == 2)

            {

                cout << " What is 76/4= ?" << endl;

                cout << " The answer is : " << endl;

                cin >> math[1];

                if (math[1] == 19)

                {

                    cout << "Thats Correct ;)" << endl;

                    score++;

                    cout << "Your score is:" << score << endl;

                }

                else

                {

                    cout << "Wrong answer :(" << endl;

                    cout << "The answer is: 19 " << endl;

                    score--;

                    cout << "Your score is:" << score << endl;

                }


            }

            if (O == 3)

            {

                cout << " What is root of 49 ? " << endl;

                cout << " The answer is : " << endl;

                cin >> math[2];

                if (math[2] == 7)

                {

                    cout << "Thats Correct ;)" << endl;

                    score++;

                    cout << "Your score is:" << score << endl;

                }

                else

                {

                    cout << "Wrong answer :(" << endl;

                    cout << "The answer is:7" << endl;

                    score--;

                    cout << "Your score is:" << score << endl;

                }


            }

            if (O == 4)

            {

                cout << " What 86+27=? " << endl;

                cout << " The answer is : " << endl;

                cin >> math[3];

                if (math[3] == 113)

                {

                    cout << "Thats Correct ;)" << endl;

                    score++;

                    cout << "Your score is:" << score << endl;

                }

                else

                {

                    cout << "Wrong answer :(" << endl;

                    cout << "The answer is:113 " << endl;

                    score--;

                    cout << "Your score is:" << score << endl;

                }


            }


            if (O == 5)

            {

                cout << " What is 43-27=? " << endl;

                cout << " The answer is : " << endl;

                cin >> math[4];

                if (math[4] == 16)

                {

                    cout << "Thats Correct ;)" << endl;

                    score++;

                    cout << "Your score is:" << score << endl;


                }

                else

                {

                    cout << "Wrong answer :(" << endl;

                    cout << "The answer is:16 " << endl;

                    score--;

                    cout << "Your score is:" << score << endl;

                }


            }

            if (O == 6)

            {

                cout << " What 21*6=? " << endl;

                cout << " The answer is : " << endl;

                cin >> math[5];

                if (math[5] == 126)

                {

                    cout << "Thats Correct ;)" << endl;

                    cout << "Your score is:" << score << endl;

                    score++;

                }

                else

                {

                    cout << "Wrong answer :(" << endl;

                    cout << "The answer is:126 " << endl;

                    score--;

                    cout << "Your score is:" << score << endl;

                }


            }


        }


        if (x == 2)

        {

            cout << "Choose between 1 ---> 6" << endl;

            cin >> O;

            if (O == 1)

            {

                cout << "When did the WW2 started ?" << endl;

                cout << " The answer is : " << endl;

                cin >> history[0];

                if (history[0] == 1939)

                {

                    cout << "Thats Correct ;)" << endl;

                }

                else

                {

                    cout << "Wrong answer :(" << endl;

                    cout << "The answer is: From ""1939"" to 1946 " << endl;

                }


            }

            if (O == 2)

            {

                cout << "When did Columbus discover America? ?" << endl;

                cout << " The answer is : " << endl;

                cin >> history[1];

                if (history[1] == 1492)

                {

                    cout << "Thats Correct ;)" << endl;

                }

                else

                {

                    cout << "Wrong answer :(" << endl;

                    cout << "The answer is:1492  " << endl;

                }


            }

            if (O == 3)

            {

                cout << " When did Hitler suicide ? " << endl;

                cout << " The answer is : " << endl;

                cin >> history[2];

                if (history[2] == 1945)

                {

                    cout << "Thats Correct ;)" << endl;

                }

                else

                {

                    cout << "Wrong answer :(" << endl;

                    cout << "The answer is:1945" << endl;

                }


            }

            if (O == 4)

            {

                cout << " When was Saladin born? " << endl;

                cout << " The answer is : " << endl;

                cin >> history[3];

                if (history[3] == 1138)

                {

                    cout << "Thats Correct ;)" << endl;

                }

                else

                {

                    cout << "Wrong answer :(" << endl;

                    cout << "The answer is:1138 " << endl;

                }


            }

            if (O == 5)

            {

                cout << " When was the United Kingdom established? " << endl;

                cout << " The answer is : " << endl;

                cin >> math[4];

                if (math[4] == 1922)

                {

                    cout << "Thats Correct ;)" << endl;

                }

                else

                {

                    cout << "Wrong answer :(" << endl;

                    cout << "The answer is:1922 " << endl;

                }


            }

            if (O == 6)

            {

                cout << " When was Independence Day in Syria?? " << endl;

                cout << " The answer is : " << endl;

                cin >> history[5];

                if (history[5] == 1946)

                {

                    cout << "Thats Correct ;)" << endl;

                }

                else

                {

                    cout << "Wrong answer :(" << endl;

                    cout << "The answer is:1946 " << endl;

                }


            }



        }

        if (x == 3)

        {

            cout << "Choose between 1 ---> 6" << endl;

            cin >> O;

            if (O == 1)

            {

                cout << "What is the longest swimming distance?" << endl;

                cout << " The answer is ____km: " << endl;

                cin >> Sport[0];

                if (Sport[0] == 151)

                {

                    cout << "Thats Correct ;)" << endl;

                }

                else

                {

                    cout << "Wrong answer :(" << endl;

                    cout << "The answer is: 151 km" << endl;

                }

            }

            if (O == 2)

            {

                cout << "How tall are the volleyball players?" << endl;

                cout << " The answer is ____cm : " << endl;

                cin >> Sport[1];

                if (Sport[1] == 195)

                {

                    cout << "Thats Correct ;)" << endl;

                }

                else

                {

                    cout << "Wrong answer :(" << endl;

                    cout << "The answer is: 195cm " << endl;

                }

            }

            if (O == 3)

            {

                cout << "How many times does Nadal win tennis championships? ? " << endl;

                cout << " The answer is : " << endl;

                cin >> Sport[2];

                if (Sport[2] == 20)

                {

                    cout << "Thats Correct ;)" << endl;

                }

                else

                {

                    cout << "Wrong answer :(" << endl;

                    cout << "The answer is:" << endl;

                }

            }

            if (O == 4)

            {

                cout << " How many Champions League Cups for Real? " << endl;

                cout << " The answer is : " << endl;

                cin >> Sport[3];

                if (Sport[3] == 13)

                {

                    cout << "Thats Correct ;)" << endl;

                }

                else

                {

                    cout << "Wrong answer :(" << endl;

                    cout << "The answer is: 13" << endl;

                }

            }

            if (O == 5)

            {

                cout << "When was the first Olympiad tournament?  " << endl;

                cout << " The answer is : " << endl;

                cin >> Sport[4];

                if (Sport[4] == 1896)

                {

                    cout << "Thats Correct ;)" << endl;

                }

                else

                {

                    cout << "Wrong answer :(" << endl;

                    cout << "The answer is: 1896 " << endl;

                }

            }

            if (O == 6)

            {

                cout << " What is the height of the basket in basketball? " << endl;

                cout << " The answer is ___m: " << endl;

                cin >> Sport[5];

                if (Sport[5] == 3)

                {

                    cout << "Thats Correct ;)" << endl;

                }

                else

                {

                    cout << "Wrong answer :(" << endl;

                   cout << "The answer is: 3.05m " << endl;

                }

            }

        }

    }

}