用string 字串
做一個選擇題
題目 選項 答案
APPLE: 1.蘋果2.香蕉3.西瓜: 1
印出來是這樣的結果
題目 APPLE
答案 1.蘋果2.香蕉3.西瓜
正確解答 1
類似這樣的題目~
20點喔~麻煩高手幫幫忙~
2007-08-14 11:35:04 · 2 個解答 · 發問者 芷涵 黃 1 in 電腦與網際網路 ➔ 程式設計
那如果要用填充題的方式來製作勒~?!
麻煩高手大大解答一下吧~
2007-08-15 09:32:03 · update #1
#include
#include
using namespace std;
int main()
{
string a[20]={"bucket","salsd","cruel","soap","minus","pet","straw","protein","lid","thunb","shepherd","pronounce","calendar","punish","obey","jeans","towel","slim","toward","alike"};
string b[20]={"水桶","生菜","提示","肥皂劇","負的","寵物","草莓","期間","男孩","拇指","混亂","代名詞的","加熱","微小","短箭號","牛仔褲","塔樓","纖細的","毛巾","相似的"};
string c[20]={"皮包","沙拉","治療","湯","加的","筆","稻草","蛋白質","眼瞼","跳躍","胡鬧,惡作劇","發音","蘇格蘭","懲罰","敬重","忌妒","毛巾","微笑的","塔樓","喜歡"} ;
string d[20]={"騎者","問安","殘酷的","肥皂","乘的","花瓣","繪圖","面具","使","兇殺的","牧羊人,羊信","尖端分叉的","日曆","辛辣","服從","吉普車","面對","狡猾的","面對","特殊"};
int ans[20]={1,2,3,3,1,1,2,2,2,1,3,2,3,2,3,1,2,1,3,1};
int i,point=0,item;
printf("\t20選擇題練習,準備開始!\n\n\n");
for(i=0;i<20;i++)
{
2007-08-15 14:47:01 補充:
cout << "題目" << i+1 << " " << ":" << a[i] << endl;
cout << "選項" << " " << ":" << 1 << b[i] << "," << 2 << c[i] << "," << 3 << d[i] << endl;
cout << "請輸入答案 :1 or 2 or 3" << endl;
cin >> item;
2007-08-15 14:47:11 補充:
if(item==ans[i])
{
cout << "答對了!\n\n" << endl;
point++;
}
else
{
2007-08-15 14:47:26 補充:
cout << "答錯了!\n\n" << endl;
}
}
cout << "\n你的分數:" << 5*point << "分" << endl;
2007-08-15 14:47:39 補充:
if(5*point<60)
{
printf("太差囉!\n\n\n");
}
2007-08-15 14:47:45 補充:
else
{
printf("不錯不錯有及格\n\n\n");
}
2007-08-15 14:47:51 補充:
system("pause");
return 0;
}
2007-08-15 10:45:29 · answer #1 · answered by strsql2002 1 · 0⤊ 0⤋
#include
#include
#include
using namespace std;
int main(int argc, char** argv){
//=====START=====//
string str[]={"Apple","Banana","Watermelon"};
cout<<"Which one is red?"<
{
cout<
}
int ans;
cout<<">>",cin>>ans;
if(ans==1)
{
cout<<"Good Job."<
else
{
cout<<"Incorrect."<
//=====END=====//
system("PAUSE");
return 0;
}
2007-08-14 15:05:07 · answer #2 · answered by Big_John-tw 7 · 0⤊ 0⤋