標題:
購物系統 (二)
[打印本頁]
作者:
tonyh
時間:
2013-6-29 15:21
標題:
購物系統 (二)
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int price[]={450,550,325,200,660,150,380};
int p,q,sum=0;
cout<<"☆★☆智能玩具店☆★☆"<<endl<<endl;
cout<<"[商品價目表]"<<endl;
cout<<"(1)遙控汽車\t450元"<<endl;
cout<<"(2)飛機模型\t550元"<<endl;
cout<<"(3)足球\t\t325元"<<endl;
cout<<"(4)拼圖\t\t200元"<<endl;
cout<<"(5)玩具槍\t660元"<<endl;
cout<<"(6)可愛玩偶\t150元"<<endl;
cout<<"(7)籃球\t\t380元"<<endl<<endl;
cout<<"[使用說明]"<<endl;
cout<<"依序輸入想購買的商品與數量,如籃球兩顆請輸入'7 2'"<<endl;
cout<<"選購完畢時輸入'8 8'進入結帳頁"<<endl<<endl;
start:
cout<<"在此輸入: ";
cin>>p>>q;
if(p>=1 && p<=7 && q>0)
{
sum=sum+price[p-1]*q;
goto start;
}else if(p==8 && q==8)
{
goto checkout;
}else
{
cout<<"輸入錯誤!"<<endl;
goto start;
}
checkout:
cout<<endl<<"總共"<<sum<<"元!"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
劉泳鱔
時間:
2013-6-29 15:36
本帖最後由 劉泳鱔 於 2013-6-30 21:36 編輯
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int p, q, price;
cout<<"╴▁▂▃▅神麼都有店▅▃▂▁╴"<<endl;
cout<<"$$商品價目表$$"<<endl;
cout<<"(1)以諾牙刷 450元/t"<<endl;
cout<<"(2)以諾手指 550元/t"<<endl;
cout<<"(3)人頭○ 325元/t/t"<<endl;
cout<<"(4)四肢↖↗↘↙ 200元/t/t"<<endl;
cout<<"(5)以諾方程式(x+a)^n=?_(k=0)^n??(n?k) x^k a^(n-k) ? 3000元/t"<<endl;
cout<<"(6)奴隸(一個月) 150元/t"<<endl;
cout<<"(7)林以諾 0元/t/t"<<endl;
cout<<"[使用規則]"<<endl;
cout<<"依序輸入想購買的商品與數量,如林以諾兩隻請輸入'7 2'<<endl;"<<endl;
cout<<"選購完畢時輸入'8 8'進入結帳頁"<<endl;
start:
cout<<"在此輸入: ";
cin>>p>>q
if(p>=1 && p<=7 && q>0)
{
sum=sum+price[p-1]*q
goto start;
}else if(p==8 && q==8)
{
goto checkout;
}else
{
cout<<"輸入錯誤"<<endl;
goto start;
}
system("pause");
return 0;
}
複製代碼
作者:
蘇昱安
時間:
2013-6-29 15:37
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int price[]={450,550,325,200,660,150,380};
int p,q,sum=0;
cout<<"智能玩具店"<<endl<<endl;
cout<<"[商品價目表]"<<endl;
cout<<"(1)遙控汽車\t450元"<<endl;
cout<<"(2)飛機模型\t550元"<<endl;
cout<<"(3)足球\t\t325元"<<endl;
cout<<"(4)拼圖\t\t200元"<<endl;
cout<<"(5)玩具槍\t660元"<<endl;
cout<<"(6)可愛玩偶\t150元"<<endl;
cout<<"(7)籃球\t\t380元"<<endl<<endl;
cout<<"[使用說明]"<<endl;
cout<<"依序輸入想購買的商品與數量,如籃球兩顆請輸入'7 2'"<<endl;
cout<<"選購完畢時輸入'8 8'進入結帳頁"<<endl<<endl;
start:
cout<<"在此輸入: ";
cin>>p>>q;
if(p>=1 && p<=7 && q>0)
{
sum=sum+price[p-1]*q;
goto start;
}else if(p==8 && q==8)
{
goto checkout;
}else
{
cout<<"輸入錯誤!"<<endl;
goto start;
}
checkout:
cout<<endl<<"總共"<<sum<<"元!"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
林以諾
時間:
2013-6-29 15:37
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int price[]={10000,5000,50000,4444,10,1744,55,10000};
int h, q, sum=0;
cout<<"以諾豪華九星級飯店"<<endl;
cout<<"[飯店房間價目表]"<<endl;
cout<<"(1)四人套房\t10000元"<<endl;
cout<<"(2)兩人套房\t5000元"<<endl;
cout<<"(3)七人小木屋\t50000元"<<endl;
cout<<"(4)孤單一人房\t4444元"<<endl;
cout<<"(5)百人總統房\t10元"<<endl;
cout<<"(6)安靈病房\t1744元"<<endl;
cout<<"(7)太平間地下房\t55元"<<endl;
cout<<"(8)跟泳鱔一夜情套房\t1元"<<endl;
cout<<"[付費說明]"<<endl;
cout<<"把要住的房間代號輸入後,再輸入要買幾間,如要買百人總統套房三間:5 3"<<endl;
cout<<"購買完請輸入9 9前往結帳"<<endl;
start:
cin>> h >> q;
if(h>=1 && h<=8 && q>0)
{
sum=sum+price[h-1]*9;
goto start;
}
else if(h==9 && q==9)
{
goto checkout;
}
else
{
cout<<"輸入錯誤!!"<<endl;
goto start;
}
checkout:
cout<<endl<<"總共"<<sum<<"元!"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
黃柏維
時間:
2013-6-29 15:40
int main()
{
int price[]={450,550,325,200,660,150,380};
int p,q,sum=0;
cout<<"***智能玩具店***"<<endl<<endl;
cout<<"**商品價目表**"<<endl;
cout<<"(1)遙控汽車\t450元"<<endl;
cout<<"(2)飛機模型\t550元"<<endl;
cout<<"(3)足球\t\t325元"<<endl;
cout<<"(4)拼圖\t\t200元"<<endl;
cout<<"(5)玩具槍\t660元"<<endl;
cout<<"(6)可愛玩偶\t150元"<<endl;
cout<<"(7)籃球\t\t380元"<<endl;
cout<<"#如要結帳請輸入代碼(8)和數量:8#"<<endl;
start:
cout<<"請輸入你要選購的商品代碼: ";
cin>> p;
cout<<"數量: ";
cin>> q;
if(p>=1 && q<=7 && q>0)
{
sum=sum+price[p-1]*q;
goto start;
}
else if(p==8 && q==8)
{
goto checkout;
}
else
{
cout<<"輸入錯誤"<<endl;
}
checkout:
cout<<endl<<"總共"<<sum<<"元!"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
黃崇維
時間:
2013-6-29 15:44
本帖最後由 黃崇維 於 2013-6-29 16:24 編輯
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int price[]={10000,12000,12300,12340,12345,123456,1234567};
int p, q, money, pay, sum=0;
cout<<"崇維智能電腦房屋店"<<endl<<endl;
cout<<"[電腦價目表]"<<endl;
cout<<"(1)一星級電腦\t10000元"<<endl;
cout<<"(2)二星級電腦\t12000元"<<endl;
cout<<"(3)三星級電腦\t12300元"<<endl;
cout<<"(4)四星級電腦\t12340元"<<endl;
cout<<"(5)五星級電腦\t12345元"<<endl;
cout<<"(6)六星級電腦\t123456元"<<endl;
cout<<"(7)七星級電腦\t1234567元"<<endl;
cout<<"[使用說明]"<<endl;
cout<<"依序輸入想購買的商品與數量,如電腦兩台請輸入'7 2'"<<endl;
cout<<"選購完畢時輸入'8 8'進入結帳頁"<<endl<<endl;
start:
cout<<"在此輸入: ";
cin>>p>>q;
if(p>=1 && p<=7 && q>0)
{
sum=sum+price[p-1]*q;
goto start;
}else if(p==8 && q==8)
{
goto checkout;
}else
{
cout<<"輸入錯誤!!"<<endl;
goto start;
}
checkout:
cout<<endl<<"總共"<<sum<<"元!"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
張瀚仁
時間:
2013-7-3 15:19
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int price[]={1240,136,2584,251,987,654};
int a,b,sum=0;
cout<<"***歡樂屋***"<<endl;
cout<<"商品價目表"<<endl;
cout<<"(1)一日喪命散\t\t1240元"<<endl;
cout<<"(2)含笑半步癲\t\t136元"<<endl;
cout<<"(3)地獄一日遊\t\t2584元"<<endl;
cout<<"(4)地獄拔舌體驗卷\t251元"<<endl;
cout<<"(5)爬劍山體驗卷\t\t987元"<<endl;
cout<<"(6)棺材訂做\t\t654元"<<endl;
cout<<"死亡一概不負責,消費滿5000送棺材乙個!!(限量 鍍金市價10000元)"<<endl;
cout<<"依序輸入想購買的商品與數量,如一日喪命散兩份請輸入'1 2'"<<endl;
cout<<"選購完畢時輸入'8 8'進入結帳頁"<<endl<<endl;
start:
cout<<"請輸入:"<<endl;
cin>>a>>b;
if(a>=1 && a<=7 && b>0)
{
sum=sum+price[a-1]*b;
goto start;
}else if(a==8 && b==8)
{
goto end;
}
else
{
cout<<"輸入錯誤"<<endl;
}
end:
cout<<endl<<"總共"<<sum<<"元!"<<endl;
if(sum>=5000)
{
cout<<"由於消費滿5000,贈送鍍金棺材乙個!!"<<endl;
}
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2