標題:
[作業] 購物系統 (一)
[打印本頁]
作者:
tonyh
時間:
2016-7-23 11:45
標題:
[作業] 購物系統 (一)
本帖最後由 tonyh 於 2016-8-6 10:26 編輯
運用陣列技巧, 設計一購物系統的商品價目表,
商店名稱
與
價錢
請同學們發揮創意自由發揮.
提示: 宣告兩個一維陣列, 分別裝商品名稱與商品價格.
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string name[]={"遙控器車","飛機模型","足球 ","拼圖 ","玩具槍 ","可愛玩偶","籃球 "};
int price[]={450,550,325,200,660,150,380};
cout<<"☆★☆智能玩具店☆★☆"<<endl<<endl;
cout<<"[商品價目表]"<<endl;
for(int i=0; i<7; i++)
cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
黃茂勛
時間:
2016-7-24 21:11
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
cout<<"☆★☆智能玩具店☆★☆"<<endl<<endl;
string commodity[8]={"新生兒",
"大小便",
"阿嬤丸",
"發瘋藥水",
"甲狀腺",
"廁所清潔劑",
"山寨包包LV",
"結帳"};
int price[7]={20,
3000,
500,
20,
600,
10,
8000,};
cout<<"[商品價目表]"<<endl;
for(int i=0; i<7; i++)
{
cout<<"("<<i+1<<")"<<commodity[i]<<"\t"<<price[i]<<"元"<<endl;
}
cout<<"(8)"<<commodity[7]<<endl;
system("pause");
return 0;
}
複製代碼
作者:
康湍榆
時間:
2016-8-6 10:30
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string name[7]={"飛盤 ",
"熊寶寶",
"足球 ",
"玩具槍",
"拼圖 ",
"筆記本",
"鉛筆 ",};
int price[7]={300,550,230,120,90,20,5};
cout<<"☆★☆智能玩具店☆★☆"<<endl;
cout<<"[商品價目表]"<<endl;
for(int i=0; i<7; i++)
{
cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
高允懋
時間:
2016-8-6 10:30
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
cout<<"☆★☆沒良心玩具店☆★☆"<<endl<<endl;
string c[5]={"破爛飛機",
"報廢汽車",
"盜版樂高",
"爆破足球",
"超醜公仔",};
int p[5]={499,588,301,886,546};
cout<<"[商品價目表]"<<endl;
for(int i=0; i<5; i++)
{
cout<<"("<<i+1<<")"<<c[i]<<"\t"<<p[i]<<"元"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
陸長辰
時間:
2016-8-6 11:06
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int p,q,sum=0;
cout<<"智能玩具店"<<endl<<endl;
cout<<"商品價目表"<<endl;
string a[5]={"統神","警察","假的","海濤法師","老鼠"};
int price[5]={87,20,40,60,80};
for(int i=0;i<5;i++)
{
cout<<"("<<i+1<<")"<<a[i]<<"\t"<<price[i]<<"元"<<endl;
}
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2