#include<iostream>
using namespace std;
void Wen(string x){
if(x=="ChuiZi"){
cout<<"Bu\n";
}else if(x=="Bu"){
cout<<"JianDao\n";
}else if(x=="JianDao"){
cout<<"ChuiZi\n";
}
}
int main(void){
string str;
int K;
cin>>K;
int i=1;
while(1){
cin>>str;
if(str=="End"){
break;
}else if(i%(K+1)||i==0){
Wen(str);
}else{
cout<<str<<'\n';
}
i++;
}
return 0;
}
这题,我学习了:
1.C++函数的定义:可以写在main函数外面,这一点和C语言类似。但是完全没有用到面向对象的概念
2.string变量类型:可以用基本操作处理字符串类型了,C++真方便啊
3.在处理结尾不能有空行的时候,尝试使用'\b',但似乎没有用(原本C语言好像就没什么用吧)