Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(int argc, char** argv)
- {
- int first_num, second_num, operator, result;
- count << "Введите число: ";
- cin >> first_num;
- count << "Введите второе число: ";
- cin >> second_num;
- count << "Введите оператор который выхоте использовать: (+, -, *, /)"
- cin >> operator;
- if (operator == '+'){
- result = first_num + second_num;
- count << "Сумма чисел: " << result << endl;
- } else if (operator == '-'){
- result = first_num - second_num;
- count << "Разность двух чисел: " << result << endl;
- } else if (operator == '*') {
- result = first_num * second_num;
- count << "Произведения двух чисел: " << result << endl;
- } else if (operator == '/') {
- result = first_num * second_num;
- count << "Деления двух чисел: " << result << endl;
- } else {
- count << "Вы ввели неправильный оператор! Повторите попытку запустив программу ещё раз!" << endl;
- }
- }
- ====================ОШИБКА КОМПИЛЯТОРА С++====================
- third.cpp: In function ‘int main(int, char**)’:
- third.cpp:6:42: error: expected initializer before ‘result’
- 6 | int first_num, second_num, operator, result;
- | ^~~~~~
- third.cpp:7:5: error: ‘count’ was not declared in this scope
- 7 | count << "Введите число: ";
- | ^~~~~
- third.cpp:16:20: error: expected ‘)’ before string constant
- 16 | if (operator == "+"){
- | ~ ^~~~
- | )
- third.cpp:16:24: error: cannot resolve overloaded function ‘operator==’ based on conversion to type ‘bool’
- 16 | if (operator == "+"){
- | ^
- third.cpp:17:9: error: ‘result’ was not declared in this scope
- 17 | result = first_num + second_num;
- | ^~~~~~
- third.cpp:19:27: error: expected ‘)’ before '-'
- 19 | } else if (operator == '-'){
- | ~ ^~~~
- | )
- third.cpp:19:31: error: cannot resolve overloaded function ‘operator==’ based on conversion to type ‘bool’
- 19 | } else if (operator == '-'){
- | ^
- third.cpp:20:9: error: ‘result’ was not declared in this scope
- 20 | result = first_num - second_num;
- | ^~~~~~
- third.cpp:22:27: error: expected ‘)’ before '*'
- 22 | } else if (operator == '*') {
- | ~ ^~~~
- | )
- third.cpp:22:31: error: cannot resolve overloaded function ‘operator==’ based on conversion to type ‘bool’
- 22 | } else if (operator == '*') {
- | ^
- third.cpp:23:9: error: ‘result’ was not declared in this scope
- 23 | result = first_num * second_num;
- | ^~~~~~
- third.cpp:25:27: error: expected ‘)’ before '/'
- 25 | } else if (operator == '/') {
- | ~ ^~~~
- | )
- third.cpp:25:31: error: cannot resolve overloaded function ‘operator==’ based on conversion to type ‘bool’
- 25 | } else if (operator == '/') {
- | ^
- third.cpp:26:9: error: ‘result’ was not declared in this scope
- 26 | result = first_num * second_num;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement