C++의 구조체

포함



포함



네임스페이스 표준 사용;
네임스페이스 게임
{
구조 게임
{
unsigned short int 점수 = 0;
무부호 짧은 정수 correctAnswers = 0;
unsigned short int playingQuestions = 0;
string playerName = "알 수 없음";

    void yourInformation();
    void gameStart();
    void gameInfo();
};

};//네임스페이스의 끝

무효 게임::게임::yourInformation()
{
cout << "콘솔로 플레이한 퀴즈 게임에 오신 것을 환영합니다"<< endl;

string userData = "unknown";

cout << "Enter your Name : ";
getline(cin, userData);
this->playerName = userData;

cout << "Ok Mr./MS. " << this->playerName << " do you want to play a Game  ? ";
getline(cin, userData);

if (userData == "yes" || "Yes" || "YES")
{
    this->gameStart();
}

}

무효 게임::게임::gameStart()
{
문자열 사용자 데이터 = "널";
cout << "인도의 수도 이름을 입력하세요";
getline(cin, userData);

this->score += userData == "new delhi" || "New Delhi" || "delhi" || "Delhi" ? 1 : 0;
this->gameInfo();

cout << "Capital City of China : ";
getline(cin, userData);
this->score += userData == "Beijing" || "beijing" || "BEIJING" ? 1 : 0;
this->gameInfo();

cout << "who is the president of Russia ? :";
getline(cin, userData);
this->score += userData == "Valadmir Putin" || "Putin" || "putin" || "Valadmir putin" || "PUTIN" || "VALADMIR PUTIN" ? 1 : 0;
this->gameInfo();

cout << "Which is world's Fastet Object Oriented Programming ? ";
getline(cin, userData);
this->score += userData == "cpp" || "Cpp" || "c++" || "C++" || "Cplusplus" || "cplusplus" || "cplus plus programming" || "cpp language" ? 1 : 0;
this->gameInfo();

cout << "which Operating system mostly used at Servers and Satelite ? ";
cout << "(a). windows, (b). Linux, (c).Mac, (d). Android" << endl;
getline(cin, userData);
this->score += userData == "b" || "Linux" || "linux" || "B" || "LINUX" ? 1 : 0;
this->gameInfo();

cout << "What is your Name ? ";
getline(cin, userData);
this->score += userData == this->playerName ? 1 : 0;
this->gameInfo();

cout << "thanks for playing Game : " << endl;

}

무효 게임::게임::게임정보()
{
this->correctAnswers = this->점수;
this->playedQuestions++;
cout << "==========================="<< endl;
cout << "점수 : "<< this->점수 << endl;
cout << "정답 : "<< this->correctAnswers << endl;
cout << "재생된 질문: "<< this->playedQuestions << endl;
cout << "==============================="<< endl;
}

무효 정보()
{
게임::게임 myGame;
myGame.yourInformation();
}

정수 메인()
{
정보();
0을 반환합니다.
}

좋은 웹페이지 즐겨찾기