机器人大军

第一次写这么长的程序,有错误指出

参考了博主「滑稽果降世」的文章

上代码喽!

#include<bits/stdc++.h>
using namespace std;
void hat(){
		cout<<"       _________"<<endl;
		cout<<"      |         |"<<endl;
		cout<<"      |_________|======O"<<endl;
}
void head(){
		cout<<"        _________"<<endl;
		cout<<"       | *____*  |"<<endl;
		cout<<"       |_|____|__|"<<endl;
}
void body(){
		cout<<"_|||_     | |     _|||_"<<endl; 
		cout<<"|___|     | |     |___|"<<endl;
		cout<<" | |______| |______| |"<<endl;
		cout<<" |____|__|__|___|____|"<<endl;
		cout<<"      |__|__|___|"<<endl;
		cout<<"      |__|__|___|"<<endl;
		cout<<"      |__|__|___|"<<endl;
}
void leg(){
		cout<<"      __________"<<endl;
		cout<<"     |  ______  |"<<endl;
		cout<<"     |  |    |  |"<<endl;
		cout<<"     |  |    |  |"<<endl;
		cout<<"     |  |    |  |"<<endl;
		cout<<"     |  |    |  |"<<endl;
}
void feat(){
		cout<<"    _____     _____ "<<endl;
		cout<<"  <|     |> <|     |>"<<endl;
		cout<<"  <|     |> <|     |>"<<endl;
		cout<<"  <|_____|> <|_____|>"<<endl;
}
 
void robot(int x){
	for(int i=0;i<x;i++){
		hat();
		head();
		body();
		leg();
		feat(); 
	}
}
void ead(){
		cout<<"   *****"<<endl;
		cout<<"  *.\*/.*"<<endl;
		cout<<" *********"<<endl;
		cout<<" *       *****"<<endl;
		cout<<"  *     *.\*/.*"<<endl;
		cout<<"   *************"<<endl;
		cout<<"       *      *"<<endl;
		cout<<"        *    *"<<endl;
		cout<<"         ****"<<endl;
}
void pokemon(int x){
	for(int i=0;i<x;i++){
		ead(); 
	}
} 
int main(){
	int b;
	string s,c;
	while(1){
		cout<<"你想要什么:机器人or宝可梦:"; 
		cin>>s;
		if(s=="机器人"){
			cout<<"你想要多少个机器人:";
			cin>>b;
			robot(b);
			system("pause");
			system("cls");
		}
		else if(s=="宝可梦"){
			cout<<"你想要多少个宝可梦:";
			cin>>b;
			pokemon(b);
			system("pause");
			system("cls");
		}
		cout<<"你还要继续玩吗?(y/n):";
		cin>>c; 
		if(c=="n"){
			return 0;
		}
	}
}

没有账号的复制这里⇣

#include<bits/stdc++.h>
using namespace std;
void hat(){
        cout<<"       _________"<<endl;
        cout<<"      |         |"<<endl;
        cout<<"      |_________|======O"<<endl;
}
void head(){
        cout<<"        _________"<<endl;
        cout<<"       | *____*  |"<<endl;
        cout<<"       |_|____|__|"<<endl;
}
void body(){
        cout<<"_|||_     | |     _|||_"<<endl; 
        cout<<"|___|     | |     |___|"<<endl;
        cout<<" | |______| |______| |"<<endl;
        cout<<" |____|__|__|___|____|"<<endl;
        cout<<"      |__|__|___|"<<endl;
        cout<<"      |__|__|___|"<<endl;
        cout<<"      |__|__|___|"<<endl;
}
void leg(){
        cout<<"      __________"<<endl;
        cout<<"     |  ______  |"<<endl;
        cout<<"     |  |    |  |"<<endl;
        cout<<"     |  |    |  |"<<endl;
        cout<<"     |  |    |  |"<<endl;
        cout<<"     |  |    |  |"<<endl;
}
void feat(){
        cout<<"    _____     _____ "<<endl;
        cout<<"  <|     |> <|     |>"<<endl;
        cout<<"  <|     |> <|     |>"<<endl;
        cout<<"  <|_____|> <|_____|>"<<endl;
}
 
void robot(int x){
    for(int i=0;i<x;i++){
        hat();
        head();
        body();
        leg();
        feat(); 
    }
}
void ead(){
        cout<<"   *****"<<endl;
        cout<<"  *.\*/.*"<<endl;
        cout<<" *********"<<endl;
        cout<<" *       *****"<<endl;
        cout<<"  *     *.\*/.*"<<endl;
        cout<<"   *************"<<endl;
        cout<<"       *      *"<<endl;
        cout<<"        *    *"<<endl;
        cout<<"         ****"<<endl;
}
void pokemon(int x){
    for(int i=0;i<x;i++){
        ead(); 
    }

int main(){
    int b;
    string s,c;
    while(1){
        cout<<"你想要什么:机器人or宝可梦:"; 
        cin>>s;
        if(s=="机器人"){
            cout<<"你想要多少个机器人:";
            cin>>b;
            robot(b);
            system("pause");
            system("cls");
        }
        else if(s=="宝可梦"){
            cout<<"你想要多少个宝可梦:";
            cin>>b;
            pokemon(b);
            system("pause");
            system("cls");
        }
        cout<<"你还要继续玩吗?(y/n):";
        cin>>c; 
        if(c=="n"){
            return 0;
        }
    }
}

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值