Ответ:
#include <iostream>
int main(){
int a = 0;
int b = 0;
char operation;
std::cout << "Enter first number: ";
std::cin >> a;
std::cout << "Enter second number: ";
std::cin >> b;
std::cout << "Enter operation: ";
std::cin >> operation;
switch (operation){
case '-':
std::cout << "a - b = " << a - b <<'\n';
break;
case '+':
std::cout << "a + b = " << a + b << '\n';
case '*':
std::cout << "a * b = " << a * b << '\n';
case '/':
std::cout << "a / b = " << a / b << '\n';
default:
std::cout << "Error\n";
}
return 0;
Объяснение:
using namespace std;
int main()
{
float х,у;
cin>>х>>у;
cout<<" "<<х+у;
cout<<" "<<х-у;
cout<<" "<<х*у;
cout<<" "<<х/у;
cout<<" "<<х%у;
cout<<" "<<sqrt(x*x+y*y);
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
#include <iostream>
int main(){
int a = 0;
int b = 0;
char operation;
std::cout << "Enter first number: ";
std::cin >> a;
std::cout << "Enter second number: ";
std::cin >> b;
std::cout << "Enter operation: ";
std::cin >> operation;
switch (operation){
case '-':
std::cout << "a - b = " << a - b <<'\n';
break;
case '+':
std::cout << "a + b = " << a + b << '\n';
break;
case '*':
std::cout << "a * b = " << a * b << '\n';
break;
case '/':
std::cout << "a / b = " << a / b << '\n';
break;
default:
std::cout << "Error\n";
}
return 0;
}
Объяснение:
Ответ:
#include <iostream>
using namespace std;
int main()
{
float х,у;
cin>>х>>у;
cout<<" "<<х+у;
cout<<" "<<х-у;
cout<<" "<<х*у;
cout<<" "<<х/у;
cout<<" "<<х%у;
cout<<" "<<sqrt(x*x+y*y);
return 0;
}