I want to make it so that after using the calculator, I can enter exit into the console and close, thereby, the console. This code is not compiled, it is written that there is an error in the last brace, while is required, but I do not understand how to enter it
#include <iostream> #include <stdio.h> #include <cstdlib> #include <locale> #include <math.h> using namespace std; int main() { setlocale(LC_ALL, "RUSSIAN"); string o; do { cout << "Выполните действие" << endl; float x, y, z; char q; cin >> x; cin >> q; cin >> y; { switch (q) { case '^': z = pow(x, y); case '+': (z = x + y); case '-': (z = x - y); case '/': (z = x / y); case '*': (z = x * y); } } cout << (z) << endl; cin >> o; if (o == "exit") exit(0); else { exit(0); } } }
do {...}construction, there is only ado {...} while ();constructiondo {...} while ();- andy.37while (true) {}- nick_n_a