標題:
2024/04/24 上課重點
[打印本頁]
作者:
鄭繼威
時間:
2024-4-24 21:03
標題:
2024/04/24 上課重點
進行
CodeBlocks軟體下載與安裝
101 基本認識-計算+9
102 基本認識-計算果汁總價
103 基本認識-總和及平均值
104 基本認識-浮點數總和
作業
練習
[KitaJudge]
101~104
實作並
通過AC
上課錄影連結
作者:
侯宣任
時間:
2024-4-28 20:19
小遊戲
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main(){
first:
int ace[]={100,200,300,400};
int w[]={2000,300,900,500};
int b[]={100,200,100,500};
int rof[]={100,550,100,400};
int cp[]={500,400,300,350};
int blood[]={1000,1000,1000,1000,1000};
int a,c;
string player[]={"艾斯","白鬍子","黑鬍子","魯夫"};
cout<<"你要選誰 1:艾斯 2:白鬍子 3:黑鬍子 4:魯夫"<<endl;
cin>>a;
if(a==1){
ace:
cout<<"你要出哪一招 1:火拳 2:火焰子彈 3:炎帝 4:雙重火拳"<<endl;
cin>>c;
if(c==1){
goto re;
}else if(c==2){
goto a;
}else if(c==3){
goto rrr;
}else if(c==4){
goto h;
}
}else if(a==2){
w:
cout<<"你要出哪一招 1:地震拳擊 2:雙海嘯 3:地震波 4:大招"<<endl;
cin>>c;
if(c==1){
goto d;
}else if(c==2){
goto e;
}else if(c==3){
goto f;
}else if(c==4){
goto g;
}
}else if(a==3){
A:
cout<<"你要出哪一招 1:閻水 2:暗穴道 3:暗黑星 4:黑洞"<<endl;
cin>>c;
if(c==1){
goto i;
}else if(c==2){
goto j;
}else if(c==3){
goto k;
}else if(c==4){
goto l;
}
}else if(a==4){
rof:
cout<<"你要出哪一招 1:猿王槍 2:大蛇炮 3:橡膠·大猿王槍 4:猿神槍"<<endl;
cin>>c;
if(c==1){
goto m;
}else if(c==2){
goto o;
}else if(c==3){
goto n;
}else if(c==4){
goto p;
}
}
複製代碼
作者:
侯宣任
時間:
2024-4-28 20:21
//cp
//艾斯攻擊
re:
blood[4]=blood[4]-ace[0];
if(blood[4]==0 || blood[4]<0){
cout<<"你贏了"<<endl;
goto first;
}else{
cout<<blood[4]<<endl;
goto cp;
}
a:
blood[4]=blood[4]-ace[1];
cout<<blood[4]<<endl;
if(blood[4]==0 || blood[4]<0){
cout<<"你贏了"<<endl;
goto first;
}else{
cout<<blood[4]<<endl;
goto cp;
}
rrr:
blood[4]=blood[4]-ace[2];
cout<<blood[4]<<endl;
if(blood[4]==0 || blood[4]<0){
cout<<"你贏了"<<endl;
goto first;
}else{
cout<<blood[4]<<endl;
goto cp;
}
h:
blood[4]=blood[4]-ace[3];
cout<<blood[4]<<endl;
if(blood[4]==0 || blood[4]<0){
cout<<"你贏了"<<endl;
goto first;
}else{
cout<<blood[4]<<endl;
goto cp;
}
//白鬍子攻擊
d:
blood[4]=blood[4]-w[0];
cout<<blood[4]<<endl;
if(blood[4]==0 || blood[4]<0){
cout<<"你贏了"<<endl;
goto first;
}else{
cout<<blood[4]<<endl;
goto cp;
}
e:
blood[4]=blood[4]-w[1];
cout<<blood[4]<<endl;
if(blood[4]==0 || blood[4]<0){
cout<<"你贏了"<<endl;
goto first;
}else{
cout<<blood[4]<<endl;
goto cp;
}
f:
blood[4]=blood[4]-w[2];
cout<<blood[4]<<endl;
if(blood[4]==0 || blood[4]<0){
cout<<"你贏了"<<endl;
goto first;
}else{
cout<<blood[4]<<endl;
goto cp;
}
g:
blood[4]=blood[4]-w[3];
cout<<blood[4]<<endl;
if(blood[4]==0 || blood[4]<0){
cout<<"你贏了"<<endl;
goto first;
}else{
cout<<blood[4]<<endl;
goto cp;
}
//黑鬍子攻擊
i:
blood[4]=blood[4]-b[0];
cout<<blood[4]<<endl;
if(blood[4]==0 || blood[4]<0){
cout<<"你贏了"<<endl;
goto first;
}else{
cout<<blood[4]<<endl;
goto cp;
}
j:
blood[4]=blood[4]-b[1];
if(blood[4]==0 || blood[4]<0){
cout<<"你贏了"<<endl;
goto first;
}else{
cout<<blood[4]<<endl;
goto cp;
}
k:
blood[4]=blood[4]-b[2];
cout<<blood[4]<<endl;
if(blood[4]==0 || blood[4]<0){
cout<<"你贏了"<<endl;
goto first;
}else{
cout<<blood[4]<<endl;
goto cp;
}
l:
blood[4]=blood[4]-b[3];
cout<<blood[4]<<endl;
if(blood[4]==0 || blood[4]<0){
cout<<"你贏了"<<endl;
goto first;
}else{
cout<<blood[4]<<endl;
goto cp;
}
//魯夫攻擊
m:
blood[4]=blood[4]-rof[0];
cout<<blood[4]<<endl;
if(blood[4]==0 || blood[4]<0){
cout<<"你贏了"<<endl;
goto first;
}else{
cout<<blood[4]<<endl;
goto cp;
}
o:
blood[4]=blood[4]-rof[1];
cout<<blood[4]<<endl;
if(blood[4]==0 || blood[4]<0){
cout<<"你贏了"<<endl;
goto first;
}else{
cout<<blood[4]<<endl;
goto cp;
}
n:
blood[4]=blood[4]-rof[2];
cout<<blood[4]<<endl;
if(blood[4]==0 || blood[4]<0){
cout<<"你贏了"<<endl;
goto first;
}else{
cout<<blood[4]<<endl;
goto cp;
}
p:
blood[4]=blood[4]-rof[3];
cout<<blood[4]<<endl;
if(blood[4]==0 || blood[4]<0){
cout<<"你贏了"<<endl;
goto first;
}else{
cout<<blood[4]<<endl;
goto cp;
}
cp:
srand(time(NULL));
int x = rand();
if(x%4==0){
if(a==1){
blood[0]=blood[0]-cp[0];
if(blood[0]<=0){
cout<<"你輸了"<<endl;
goto first;
}else
goto ace;
}else if(a==2){
blood[1]=blood[1]-cp[0];
if(blood[1]<=0){
cout<<"你輸了"<<endl;
goto first;
}else
goto w;
}else if(a==3){
blood[2]=blood[2]-cp[0];
if(blood[2]<=0){
cout<<"你輸了"<<endl;
goto first;
}else
goto A;
}else if(a==4){
blood[3]=blood[3]-cp[0];
if(blood[3]<=0){
cout<<"你輸了"<<endl;
goto first;
}else
goto rof;
}
}else if(x%4==1){
if(a==1){
blood[0]=blood[0]-cp[1];
if(blood[0]<=0){
cout<<"你輸了"<<endl;
goto first;
}else
goto ace;
}else if(a==2){
blood[1]=blood[1]-cp[1];
if(blood[1]<=0){
cout<<"你輸了"<<endl;
goto first;
}else
goto w;
}else if(a==3){
blood[2]=blood[2]-cp[1];
if(blood[2]<=0){
cout<<"你輸了"<<endl;
goto first;
}else
goto A;
}else if(a==4){
blood[3]=blood[3]-cp[1];
if(blood[3]<=0){
cout<<"你輸了"<<endl;
goto first;
}else
goto rof;
}
}
else if(x%4==3){
if(a==1){
blood[0]=blood[0]-cp[3];
if(blood[0]<=0){
cout<<"你輸了"<<endl;
goto first;
}else{
goto ace;
}
}else if(a==2){
blood[1]=blood[1]-cp[3];
if(blood[1]<=0){
cout<<"你輸了"<<endl;
goto first;
}else
goto w;
}else if(a==3){
blood[2]=blood[2]-cp[3];
if(blood[2]<=0){
cout<<"你輸了"<<endl;
goto first;
}else
goto A;
}else if(a==4){
blood[3]=blood[3]-cp[3];
if(blood[3]<=0){
cout<<"你輸了"<<endl;
goto first;
}else
goto rof;
}
}
else if(x%4==2){
if(a==1){
blood[0]=blood[0]-cp[2];
if(blood[0]<=0){
cout<<"你輸了"<<endl;
goto first;
}else
goto ace;
}else if(a==2){
blood[1]=blood[1]-cp[2];
if(blood[1]<=0){
cout<<"你輸了"<<endl;
goto first;
}else
goto w;
}else if(a==3){
blood[2]=blood[2]-cp[2];
if(blood[2]<=0){
cout<<"你輸了"<<endl;
goto first;
}else
goto A;
}else if(a==4){
blood[3]=blood[3]-cp[2];
if(blood[3]<=0){
cout<<"你輸了"<<endl;
goto first;
}else
goto rof;
}
}
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2