65,210
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <string>
using namespace std;
class trivia
{
public:
void question1();
void question2();
void question3();
void question4();
void question5();
int i;
};
void main()
{
trivia a;
int c;
string strinfo;
string ans;
do{
cout<<"输入你想回答问题的号码1-5"<<endl;
cout<<"the 1 is 2point, 2 is 3point ,3 is 5point, 4 is point,5 is 10point"<<endl;
cin>>c;
switch(c)
{
case 1:
{
cout<<"问题是"<<endl;
cout<<"Second largest city in Korea?"<<endl;
a.question1();
break;
}
case 2:
{
cout<<"问题是"<<endl;
cout<<"Fourth planet from the Sun?"<<endl;
a.question2();
break;
}
case 3:
{
cout<<"问题是"<<endl;
cout<<"National younger sister in Korea?"<<endl;
a.question3();
break;
}
case 4:
{
cout<<"问题是"<<endl;
cout<<"2002 FIFA World Cup winner?"<<endl;
a.question4();
break;
}
case 5:
{
cout<<"问题是"<<endl;
cout<<"Professor Yoo’s favorite actress?"<<endl;
a.question5();
break;
}
}
cout<<"你还想继续回答问题吗? y or n"<<endl;
cin>>ans;
}while(ans=="y");
}
void trivia::question1()
{
string string1;
cout<<"input your answer:"<<endl;
cin>>string1;
if(string1=="pusan")
cout<<"you are right,you can get 2 point"<<endl;
else
cout<<"you are wrong,the right answer is pusan"<<endl;
}
void trivia::question2()
{
string string2;
cin>>string2;
if(string2=="mars")
cout<<"you are right,you can get 3 point"<<endl;
else
cout<<"you are wrong,the right answer is pusan"<<endl;
}
void trivia::question3()
{
string string3;
cin>>string3;
if(string3=="yunakim")
cout<<"you are right,you can get 5 point"<<endl;
else
cout<<"you are wrong,the right answer is pusan"<<endl;
}
void trivia::question4()
{
string string4;
cin>>string4;
if(string4=="brazil")
cout<<"you are right,you can get 7 point"<<endl;
else
cout<<"you are wrong,the right answer is pusan"<<endl;
}
void trivia::question5()
{
string string5;
cin>>string5;
if(string5=="drew")
cout<<"you are right,you can get 10 point"<<endl;
else
cout<<"you are wrong,the right answer is pusan"<<endl;
}
#include <iostream>
#include <string>
using namespace std;
class trivia
{
public:
void question1();
void question2();
void question3();
void question4();
void question5();
int i;
};
void main()
{
trivia a;
int c;
string strinfo;
string ans;
do{
cout < <"输入你想回答问题的号码1-5" < <endl;
cout < <"the 1 is 2point, 2 is 3point ,3 is 5point, 4 is point,5 is 10point" < <endl;
cin>>c;
switch(c)
{
case 1:
{
cout < <"问题是" < <endl;
cout < <"Second largest city in Korea?" < <endl;
a.question1();
break;
}
case 2:
{
cout < <"问题是" < <endl;
cout < <"Fourth planet from the Sun?" < <endl;
a.question2();
break;
}
case 3:
{
cout < <"问题是" < <endl;
cout < <"National younger sister in Korea?" < <endl;
a.question3();
break;
}
case 4:
{
cout < <"问题是" < <endl;
cout < <"2002 FIFA World Cup winner?" < <endl;
a.question4();
break;
}
case 5:
{
cout < <"问题是" < <endl;
cout < <"Professor Yoo’s favorite actress?" < <endl;
a.question5();
break;
}
}
cout < <"你还想继续回答问题吗? y or n" < <endl;
cin>>ans;
}while(ans=="y");
}
void trivia::question1()
{
string string1;
cout < <"input your answer:" < <endl;
cin>>string1;
if(string1=="pusan")
cout < <"you are right,you can get 2 point" < <endl;
else
cout < <"you are wrong,the right answer is pusan" < <endl;
}
void trivia::question2()
{
string string2;
cin>>string2;
if(string2=="mars")
cout < <"you are right,you can get 3 point" < <endl;
else
cout < <"you are wrong,the right answer is pusan" < <endl;
}
void trivia::question3()
{
string string3;
cin>>string3;
if(string3=="yunakim")
cout < <"you are right,you can get 5 point" < <endl;
else
cout < <"you are wrong,the right answer is pusan" < <endl;
}
void trivia::question4()
{
string string4;
cin>>string4;
if(string4=="brazil")
cout < <"you are right,you can get 7 point" < <endl;
else
cout < <"you are wrong,the right answer is pusan" < <endl;
}
void trivia::question5()
{
string string5;
cin>>string5;
if(string5=="drew")
cout < <"you are right,you can get 10 point" < <endl;
else
cout < <"you are wrong,the right answer is pusan" < <endl;
}