Untitled
unknown
c_cpp
2 years ago
798 B
4
Indexable
#include <iostream> int main() { int x, y; char pt; std::cout << "Nhap x: "; std::cin >> x; std::cout << "Nhap y: "; std::cin >> y; std::cout << "Nhap phep tinh: "; std::cin >> pt; switch(pt) { case '+': printf("%d + %d = %d.\n", x, y, x + y); break; case '-': printf("%d - %d = %d.\n", x, y, x - y); break; case '*': printf("%d * %d = %d.\n", x, y, x * y); break; case '/': if (y == 0) printf("Khong chia duoc\n"); else printf("%d / %d = %d.\n", x, y, x / y); break; default: std::cout << "Nhap sai phep tinh"; break; } return 0; }
Editor is loading...