第一周_算法训练_前缀表达式
本文最后更新于 1828 天前,其中的信息可能已经有所发展或是发生改变。
#include<iostream>
#include<string>
#include<cstring>
using namespace std;
int add(int obj1,int obj2){
	int obj3;
	obj3=obj1+obj2;
	return obj3;
}
int subtract(int obj1,int obj2){
	int obj3;
	obj3=obj1-obj2;
	return obj3;
}
int multiply(int obj1,int obj2){
	int obj3;
	obj3=obj1*obj2;
	return obj3;
}
int divide(int obj1,int obj2){
	int obj3;
	obj3=obj1/obj2;
	return obj3;
}
int main(){
	string str;
	int obj1,obj2,obj3;
	cin>>str>>obj1>>obj2;
	if(!str.compare("+")){
		cout<<add(obj1,obj2);
	}
	else if(!str.compare("-")){
		cout<<subtract(obj1,obj2);
	}
	else if(!str.compare("*")){
		cout<<multiply(obj1,obj2);
	}
	else if(!str.compare("/")){
		cout<<divide(obj1,obj2);
	}	
	return 0;
}
作者:Yuyy
博客:https://yuyy.info
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇