標題:
購物系統 (一)
[打印本頁]
作者:
鄭繼威
時間:
2023-4-21 21:06
標題:
購物系統 (一)
本帖最後由 鄭繼威 於 2023-4-28 20:19 編輯
運用陣列技巧,設計一購物系統的商品價目表,
商店名稱
與
商品價格
請同學們發揮創意
自由發揮
。
提示:宣告兩個一維陣列,分別裝
商品名稱
與
商品價格
。
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
//商品名稱
string name[]={"遙控汽車","飛機模型","足球\t","拼圖\t","玩具槍","可愛玩偶","籃球\t"};
//商品價格
int price[]={450,550,325,200,660,150,380};
cout<<"☆★☆智能玩具店☆★☆"<<endl<<endl;
cout<<"[商品價目表]"<<endl;
//把選項|名稱|價格輸出
for(int i=0;i<=6;i++)
{
cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
蔡沛倢
時間:
2023-4-28 20:14
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string a[]={"遙控汽車","飛機模型","足球 ","拼圖 ","玩具槍 ","可愛玩偶","籃球 "};
int e[]={450,550,325,200,660,150,380};
cout<<"☆★☆智能玩具店☆★☆"<<endl<<endl;
cout<<"[商品價目表]"<<endl;
for(int b=0;b<7;b++){
cout<<"("<<b+1<<")"<<a[b]<<"\t"<<e[b]<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
邵凡榛
時間:
2023-4-28 20:15
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string name[]={"遙控汽車","飛機模型","玩具槍","玩偶 ","籃球 "};
int price[]={450,550,325,200,660};
cout<<"智能玩具店"<<endl<<endl;
cout<<"商品價目表"<<endl;
for(int i=0;i<=4;i++)
cout<<"["<<i+1<<"]"<<name[i]<<"\t"<<price[i]<<endl;
system("pause");
return 0;
}
複製代碼
作者:
黃子豪
時間:
2023-4-28 20:16
本帖最後由 黃子豪 於 2023-4-28 20:27 編輯
#include<iostream>
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;
}
複製代碼
作者:
呂宗晉
時間:
2023-4-28 20:19
本帖最後由 呂宗晉 於 2023-5-17 19:21 編輯
#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<=6;i++)
{
cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
鄭繼威
時間:
2023-4-28 20:19
3
作者:
何權晉
時間:
2023-4-28 20:20
#include <iostream>
using namespace std;
int main()
{
string name[]={"R/C Car", "Model Plane", "Football", "Tennis Ball","Toy Gun","Basketball"};
int price[]={400,690,678,560,570,300};
cout<<"*****Da Epic Toy Store*****"<<endl<<endl;
cout<<"[Products]"<<endl;
for(int i=0;i<=5;i++)
{
cout<<"("<<i+1<<")"<<name[i]<<"\t"<<"$"<<price[i]<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
曹祁望
時間:
2023-4-28 20:21
#include<iostream>
#include<cstdlib>
using namespace std;
int main(){
string names[3]={"餅乾","糖果","飲料"};
int price[3]={5,10,15};
for(int i=0;i<=2;i++){
cout<<i+1<<names[i]<<"\t"<<price[i]<<"\n";
}
system("pause");
return 0;
}
複製代碼
作者:
張絜晰
時間:
2023-4-28 20:21
#include<cstdlib>
#include<iostream>
using namespace std;
int main(){
string m[7]={"兔子布偶","文具組合","高級餅乾","鍵盤滑鼠","遊戲點數","藍色外套","神秘獎品"};
int n[7]={100,200,150,800,487,666,999};
cout<<"雜七雜八雜貨店價目表"<<endl;
for(int a=0;a<7;a++){
cout<<a+1<<"\t"<<m[a]<<"\t"<<n[a]<<"元"<<endl;
}
system ("pause");
return 0;
}
複製代碼
作者:
盧玄皓
時間:
2023-4-28 20:24
本帖最後由 盧玄皓 於 2023-4-28 20:28 編輯
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string n[]={"手槍 ","彈藥 ","98K ","AWM ","M500 ","沙漠之鷹 "};
int price[]={10000,450,98000,100000,43000,52000};
cout<<"fire槍械店"<<endl<<endl;
cout<<"[槍械價目表]"<<endl;
for(int i=0;i<6;i++)
{
cout<<"("<<i+1<<")"<<n[i]<<"\t"<<price[i]<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
呂得銓
時間:
2023-4-28 20:25
本帖最後由 呂得銓 於 2023-5-17 19: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<=6;i++)
{
cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
鄭繼威
時間:
2023-4-28 20:28
9
作者:
張桔熙
時間:
2023-4-28 20:44
#include<iostream>
using namespace std;
int main(){
string name[]={"傷藥","解麻藥","好傷藥","寶貝球","高級球"};
int price[]={200,400,500,200,800};
cout<<" 寶可夢商店 "<<endl<<endl;
cout<<"[商品價格表]"<<endl;
for(int i=0; i<5; i++)
cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
廖秝瑜
時間:
2023-4-28 20:49
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string name[]={"紅茶 ","奶茶 ","牛奶 ","咖啡 ","果汁 "};
int price[]={50,75,60,75,30,};
cout<<"☆★☆智能飲料店☆★☆"<<endl<<endl;
cout<<"[商品價目表]"<<endl;
for(int i=0;i<=4;i++)
{
cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
邱品惟
時間:
2023-8-7 17:56
#include<iostream>
using namespace std;
int main()
{
string name[]={"遙控汽車","飛機模型","足球\t","拼圖\t","玩具槍","可愛玩偶","籃球\t"};
int price[]={450,550,325,200,660,150,380};
cout<<"☆★☆智能玩具店☆★☆"<<endl<<endl;
cout<<"[商品價目表]"<<endl;
for(int i=0;i<=6;i++)
{
cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<endl;
}
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2