標題:
購物系統 (一)
[打印本頁]
作者:
歐柏罕
時間:
2018-3-5 19:14
標題:
購物系統 (一)
本帖最後由 歐柏罕 於 2018-3-5 19:32 編輯
運用陣列技巧, 設計一購物系統的商品價目表, 商店名稱與商品價格請同學們發揮創意自由發揮.
提示: 宣告兩個一維陣列, 分別裝商品名稱與商品價格.
作者:
歐柏罕
時間:
2018-3-5 19:32
https://home.gamer.com.tw/creationDetail.php?sn=2061690
作者:
彭煥宇
時間:
2018-3-5 19:32
#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;
}
複製代碼
作者:
曾堂桂
時間:
2018-3-5 19:33
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int price[7]={450,550,325,200,660,150,380};
string thing[7]={"遙控汽車","飛機模型","足球 ","拼圖 ","玩具槍","可愛玩偶","籃球 "};
cout<<" 智能玩具店"<<endl;
cout<<endl;
cout<<"[商品價目表]"<<endl;
for(int i=0; i<7; i++)
{
cout<<"<"<<i+1<<">"<<thing[i]<<"\t"<<price[i]<<"元"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
洪翊展
時間:
2018-3-5 19:39
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string name[]={"球1","球2","球3","球4","球5","球6","球7"};
int price[]={100,100,100,100,100,1000,100};
cout<<"☆★☆玩具店☆★☆"<<endl;
cout<<"[商品價目表]"<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
for(int i=0; i<7; i++ )
{
cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
盧佑恩
時間:
2018-3-5 19:40
#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\t"<<price[i]<<"元"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
盧佑芯
時間:
2018-3-5 19:41
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int p[]={450,550,325,200,660,150,380};
string n[]={"遙控汽車","飛機模型","足球","拼圖","玩具槍","可愛玩偶","籃球"};
int a=0;
cout<<"★☆★智能玩具店★☆★"<<endl;
cout<<"[商品價目表]"<<endl;
for(int i=0;i<7;i++)
{
a++;
cout<<"("<<a<<")"<<n[i]<<" "<<p[i]<<"元"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
沈子晏
時間:
2018-3-5 19:42
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string a[7]={"遙控汽車","飛機模型","足球\t","拼圖\t","玩具槍","可愛玩偶","籃球\t"};
int n[7]={450,550,325,200,660,150,380};
cout<<"☆★☆益智遊戲☆★☆"<<endl;
cout<<"[商品價目表]"<<endl;
for(int i=0; i<7; i++)
{
cout<<"("<<i<<")"<<a[i]<<"\t"<<n[i]<<"元"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
洪翊庭
時間:
2018-3-5 19:48
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string name[7]={"球","球","球","球","球","球","球"};
int price[7]={0,0,0,0,0,0,0};
cout<<" ☆★★洪翊庭大帥哥店☆☆★ "<<endl<<endl;
for(int i=0; i<7; i++)
{
cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
李治毅
時間:
2018-3-5 19:48
本帖最後由 李治毅 於 2018-3-5 20:10 編輯
#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;
}
複製代碼
作者:
啓銓
時間:
2018-3-5 19:48
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
cout<<"〒自障玩具店〒"<<endl;
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;
system("pause");
return 0;
}
複製代碼
作者:
黃宇瑄
時間:
2018-3-5 19:53
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
string name[]={"遙控汽車","飛機模型","足球\t","拼圖\t","玩具槍","可愛玩偶","籃球\t"};
int price[]={450,200,50,20,90,40,30};
cout<<"☆★☆智能玩具店☆★☆"<<endl;
cout<<endl<<"[商品價目表]"<<endl;
for(int i=0; i<7; i++)
{
cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
黃宇綸
時間:
2018-3-5 20:02
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
re:
system("cls");
string toy[]={"遙控器車","飛機模型","足球\t","拼圖\t","玩具槍\t","可愛玩偶","籃球\t"};
int a[]={100,21,258,9852,3333,159,95};
cout<<"☆★☆智能玩具店☆★☆"<<endl;
cout<<endl<<"[商品價目表]"<<endl;
for(int j=0;j<7;j++)
{
cout<<"("<<j+1<<")";
cout<<toy[j]<<a[j]<<"元"<<endl;
}
system("pause");
goto re;
return 0;
}
複製代碼
作者:
洪翊展
時間:
2018-3-5 21:02
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
re:
system("cls");
string name[]={"球1","球2","球3","球4","球5","球6","球7"};
int price[]={100,100,100,100,100,1000,100};
cout<<"☆★☆玩具店☆★☆"<<endl;
cout<<"[商品價目表]"<<endl;
cout<<" "<<endl;
for(int i=0; i<7; i++ )
{
cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
}
cout<<"<8>結帳"<<endl;
int tempn=0;
cout<<"輸入商品代碼"<<endl;
cin>>tempN;
if(p==8)
{
goto checkout;
}
else if(p>=1&&p<=7)
{
cout<<"數量";
cin>>q;
sum+=price[p-1]*q;
goto re2;
}
else
{
goto re;
}
}
system("pause");
goto re;
return 0;
}
複製代碼
作者:
洪翊庭
時間:
2018-3-5 21:03
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
re:
system("cls");
string name[8]={"球","球","球","球","球","球","球","結帳"};
int price[7]={0,0,0,0,0,0,0};
cout<<" ☆★★洪翊庭大帥哥店☆☆★ "<<endl<<endl;
for(int i=0; i<8; i++)
{
cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
}
cout<<"(8)結帳"<<endl<<endl;
re2:
cout<<"請輸入商品代碼"<<endl;
cin>>p;
if(p==8)
{
goto checkout;
}else if(p>=%%p<=7)
{
cout<<"數量"<<endl;
system("pause");
goto re;
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2