📄 f0512.cpp
字号:
//=====================================
// f0512.cpp
// 命令解析
//=====================================
#include<iostream>
#include<sstream>
using namespace std;
//-------------------------------------
int main(int argc, char** argv){
if(argc!=2){
cout<<"usage: f0512 command\n";
return 1;
}
string s(argv[1]);
istringstream sin(s);
int a,b; char c;
sin>>a>>c>>b;
switch(c){
case'-': b=-b;
case'+': cout<<a+b; break;
case'*': cout<<a*b; break;
case'/': cout<<a/b; break;
default: cout<<"error";
}
}//====================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -