c++ - where do i put the do-while loop in a calculator program -


i cant figure out put loop parts simple y/n (repeat/exit) loop.i tried find answers, none clear enough particular case. p.s. iam beginner @ coding, please dont make complicated unless necessary code far

#include <stdio.h> #include <iostream> using namespace std;  // input function void input (float &x, float &y);  float a=1.0, b=1.0, result; char operation; char yesno;   int main ()  { {     cout << "programma wat optelt, aftrekt, vermedigvuldigd en deelt. \n\n";      cout << "geef een opdracht (eg. 1 + 2): \n";     cin >> >> operation >> b;      input (a,b);      cout << "het antwoord is: " << result << endl;     system ("pause");     return 0; }  while (yesno == 'y'); void input (float &x, float &y) {     = x;     b = y;      switch (operation)     {         case '+':             result = x + y;             break;          case '-':             result = x - y;             break;          case '*':             result = x * y;             break;          case '/':             result = x / y;             break;          default:             cout << "foutieve invoer: \n";             cin >> >> operation >> b;             input (a, b);     }   }  } 

it stops because of return statement in "int main". suggest using "void main ()" instead of "int main ()". if want use "int main ()", shift "return 0" below while statement. need ask user if or wants continue. try this: (ignore bad spacing)

int main () {     {         cout << "programma wat optelt, aftrekt, vermedigvuldigd en deelt. \n\n";          cout << "geef een opdracht (eg. 1 + 2): \n";         cin >> >> operation >> b;          input (a,b);          cout << "het antwoord is: " << result << endl;         cout << "press y continue: ";         cin >> yesno;     } while (yesno == 'y');     return 0; }