c2
This commit is contained in:
parent
0d75f30a49
commit
4744ebb565
69 changed files with 7 additions and 5 deletions
34
1sem/adaptation courses/02/7.cpp
Normal file
34
1sem/adaptation courses/02/7.cpp
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
// ac_2_7.cpp
|
||||
// Горбацевич Андрей
|
||||
#include <stdio.h>
|
||||
#include <cmath>
|
||||
#include <clocale>
|
||||
#include <afxres.h>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
SetConsoleCP(CP_UTF8);
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
setlocale(LC_ALL, "ru_RU.UTF-8");
|
||||
double op1, op2;
|
||||
char f;
|
||||
printf("<first operand> <operator> <second operand> >>>");
|
||||
scanf("%lf %s %lf", &op1, &f, &op2);
|
||||
switch (f) {
|
||||
case '+':
|
||||
printf("%lf\n", op1 + op2);
|
||||
break;
|
||||
case '-':
|
||||
printf("%lf\n", op1 - op2);
|
||||
break;
|
||||
case '*':
|
||||
printf("%lf\n", op1 * op2);
|
||||
break;
|
||||
case '/':
|
||||
printf("%lf\n", op1 / op2);
|
||||
break;
|
||||
default:
|
||||
printf("Incorrect operator");
|
||||
break;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue