c++ simple game project #cpp #codewithharry

 I hope you Subscribe my channel 

Source code


#include <iostream>
#include <windows.h>
using namespace std;
//Created by:- skeleton programmer 
// I hope you Subscribe my channel 
void start()
{
    string name, answer;
    for(int i=1; i<=1;i++){
     cout<<"S"<<endl;
     sleep(1);
       cout<<"T"<<endl;
     sleep(1);
       cout<<"A"<<endl;
     sleep(1);
       cout<<"R"<<endl;
     sleep(1);
       cout<<"T"<<endl;
     sleep(1);
    
     
     }
    cout << "\nLet's Start the Game " << endl;
    sleep(1);
    cout << "Enter your name " << endl;
    cin >> name;
    cout << "Q1. What is 2 + 2. ?" << endl;
    sleep(1);
    cout << "Choose one " << endl;
    sleep(1);
    cout << "a = 4" << endl;
    cout << "b = 6" << endl;
    cout << "c = 9" << endl;
    cout << "d = 9" << endl;
    cin >> answer;
    if (answer == "a")
    {
        sleep(1);
        cout << "Wow You choose write answer " << endl;
    }
    else
    {
        cout << "×--You choose Wrong answer--× " << endl;
        for(int i=1; i<=1; i++){
         sleep(1);
         cout<<"W \n R\n O\n N\nG "<<endl;
        }
    }
};
int main()
{
    string input;
    cout << "<<====W E L C O M E====>>\n";
    sleep(1);
    cout << "You want to Play " << endl;
    cin >> input;

    if (input == "Yes")
    {
        cout << "OK! " << endl;
        
        start();
    }
    else if (input == "yes")
    {
        cout << "OK! " << endl;
    
        start();
    }

    else
    {
        cout << "OK! " << endl;
        sleep(1);
        cout << " ×-Not start-× " << endl;
    }
}




Comments