Обсудить проект
return 0; }
cout << "\n--- Prime Number Checker ---\n"; cout << "Enter a positive integer: "; cin >> num; dev c 5.12
void showMenu() { cout << "\n========== CALCULATOR FEATURE ==========\n"; cout << "1. Basic Calculator (+, -, *, /)\n"; cout << "2. Advanced Calculator (^, √, sin, cos, tan)\n"; cout << "3. Number Statistics (Sum, Average, Min, Max)\n"; cout << "4. Prime Number Checker\n"; cout << "5. Temperature Converter (Celsius/Fahrenheit)\n"; cout << "6. Exit\n"; cout << "========================================\n"; } return 0; } cout << "\n--- Prime Number
if(num <= 1) { isPrime = false; } else { for(int i = 2; i <= sqrt(num); i++) { if(num % i == 0) { isPrime = false; break; } } } Number Statistics (Sum, Average, Min, Max)\n"; cout <<
switch(operation) { case '+': cout << "\nResult: " << num1 << " + " << num2 << " = " << num1 + num2 << endl; break; case '-': cout << "\nResult: " << num1 << " - " << num2 << " = " << num1 - num2 << endl; break; case '*': cout << "\nResult: " << num1 << " * " << num2 << " = " << num1 * num2 << endl; break; case '/': if(num2 != 0) cout << "\nResult: " << num1 << " / " << num2 << " = " << num1 / num2 << endl; else cout << "\nError: Division by zero!\n"; break; default: cout << "\nInvalid operator!\n"; } }