文件写入写出\输完输入加一个Ctrl Z
by 小小蒲公英 @ 2024-04-19 19:42:04
加ctrl z @[andy605](/user/756608)
by lczcy1 @ 2024-04-19 20:02:18
```cpp
#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")x*=100;//修改
if(str=="thousand"){y+=x*1000;x=0;}
if(str=="million"){y+=x*1000000;x=0;}
}
y+=x;//修改
if(flag)cout<<"-";
cout<<y<<"\n";
return 0;
}
```
@[andy605](/user/756608)
by lczcy1 @ 2024-04-19 20:13:19
@[lczcy1](/user/1087173) @[小小蒲公英](/user/392816) 感谢各位大佬!
by andy605 @ 2024-04-20 09:23:22