:(怎么才能让它输出?!?!?!
  • 板块P2108 学英语
  • 楼主andy605
  • 当前回复3
  • 已保存回复3
  • 发布时间2024/4/19 19:32
  • 上次更新2024/4/19 21:07:15
查看原帖
:(怎么才能让它输出?!?!?!
756608
andy605楼主2024/4/19 19:32
#include <bits/stdc++.h>
using namespace std;
int main(){
	string str;
	int x=0,y=0;
	bool flag=false;
	while(cin>>str){
		if(str=="negative") flag=true;
		if(str=="one") x+=1;
		if(str=="two") x+=2;
		if(str=="three") x+=3;
		if(str=="four") x+=4;
		if(str=="five") x+=5;
		if(str=="six") x+=6;
		if(str=="seven") x+=7;
		if(str=="eight") x+=8;
		if(str=="nine") x+=9;
		if(str=="ten") x+=10;
		if(str=="eleven") x+=11;
		if(str=="twelve") x+=12;
		if(str=="thirteen") x+=13;
		if(str=="fourteen") x+=14;
		if(str=="fifteen") x+=15;
		if(str=="sixteen") x+=16;
		if(str=="seventeen") x+=17;
		if(str=="eighteen") x+=18;
		if(str=="nineteen") x+=19;
		if(str=="twenty") x+=20;
		if(str=="thirty") x+=30;
		if(str=="forty") x+=40;
		if(str=="fifty") x+=50;
		if(str=="sixty") x+=60;
		if(str=="seventy") x+=70;
		if(str=="eighty") x+=80;
		if(str=="ninety") x+=90;
		if(str=="hundred"){y+=x*100;x=0;}
		if(str=="thousand"){y+=x*1000;x=0;}
		if(str=="million"){y+=x*1000000;x=0;}
	}
	if(flag) cout<<"-";
	cout<<y<<"\n";
	return 0;
}

大佬求助QWQ!没有输出

离奇地得了两分

2024/4/19 19:32
加载中...