#include <iostream>
#include <iomanip>
int main() {
int a, b;
char op;
while (true) {
std::cin >> a >> op >> b;
if (op == '?') {
break;
}
if (op == '+') {
std::cout << a + b << std::endl;
}
if (op == '-') {
std::cout << a - b << std::endl;
}
if (op == '*') {
std::cout << a * b << std::endl;
}
if (op == '/') {
std::cout << a / b << std::endl;
}
}
}
|
オンラインジャッジではじめるC/C++プログラミング入門 (マイナビ)AIZU ONLINE JUDGE のコース問題を題材にした解説書です。各トピックごとに C/C++ 言語の基礎的な内容を学習し、Introduction to Programming の演習問題にチャレンジしていきます。内容は敷居の高いものではなく、プログラミング初学者が取り組む例題からスタートしています。 |