0

Why I don't get the correct output in c++?

#include <iostream> using namespace std; Int main() { char op; float num1, num2; cin >> op; cin >> num1 >> num2; { cout << num1 + num2; break; cout << num1 - num2; break; cout << num1 * num2; break; cout << num1 / num2; break; cout << "Error! operator is not correct"; break; } return 0; }

9th Jul 2022, 9:40 AM
Yashica Jain
Yashica Jain - avatar
2 Answers
+ 2
What output are you expecting?
9th Jul 2022, 12:35 PM
Justice
Justice - avatar
+ 1
Also: 1. "Int" is not valid. You hopefully want "int". 2. What are the "break" statements for? 3. What is variable "op" for?
10th Jul 2022, 12:19 AM
Emerson Prado
Emerson Prado - avatar