3

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> #include <cmath> using namespace std; void Task22() { cout << "Вариант 22" << endl << "Введите количество рублей (от 1 до 999):" << endl; int x; cin >> x; if (x % 10 == 1 && x - 100 * (x / 100) != 11) { cout << x << " " << "рубль"; } if (x % 10 > 1 && x % 10 < 5 && (x - 100 * (x / 100)) / 10 != 1) { cout << x << " " << "рубля"; } if (x % 10 > 4 || (x - 100 * (x / 100)) / 10 == 1 || x % 10 == 0) { cout << x << " " << "рублей"; } cout << endl << endl; } void Task15() { cout << "Вариант 15" << endl << "Введите два числа и нажмите <Enter>..." << endl; int x, y, z; cin >> x >> y; cout << "Сколько будет" << " " << x << "-" << y << "? Введите ответ и нажмите <Enter>..." << endl; cin >> z; if (z == x - y) { cout << "Правильно!"; } else { cout << "Вы ошиблись!"; } cout << endl << endl; } int main() { setlocale(LC_ALL, "Russian"); system("cls"); int number; int a = 1; while (a == 1) { cout << "Введите номер варианта (чтобы выйти, введите 0)..." << endl; tryagain: cin >> number; cout << endl; if (number == 22) { Task22(); } if (number == 15) { Task15(); } if (number != 22 && number != 15 && number != 0) { cout << "Неверный номер, введите еще раз..." << endl << endl; goto tryagain; } if (number == 0) { a = number; } } }
Editor Settings
Theme
Key bindings
Full width
Lines