Untitled

mail@pastecode.io avatar
unknown
c_cpp
2 months ago
919 B
1
Indexable
Never
#include <iostream>
using namespace std;

int step(int a, int b) {
	int sum = a;
	for (int i = 1; i < b; i++)
	{
		sum *= a;
	}return sum;
}

int slog(int a, int b) {
	int otvet;
	otvet = a + b;
	return otvet;

}
int vichet(int a, int b) {
	int otvet;
	otvet = a - b;
	return otvet;

}
int ymnog(int a, int b) {
	int otvet;
	otvet = a * b;
	return otvet;

}
int del(int a, int b) {
	int otvet;
	otvet = a / b;
	return otvet;

}

/*...☆.´..☆
.........´.¸.☆´ ☆
...........☆.´..☆´
................(.☆
.................))     
...............██Ɔ

*/

int main() {
	int a, b;
	cin >> a >> b;
	char op;
	cin >> op;
	if (op == '+') {
		cout << slog(a, b);
	}
	if (op == '-') {
		cout << vichet(a, b);
	}
	if (op == '*') {
		cout << ymnog(a, b);
	}
	if (op == '/') {
		cout << del(a, b);
	}
	if (op == '^') {
		cout << step(a, b);
	}

}
Leave a Comment