[Solved] where do i put the do-while loop in a calculator program [closed]


It stops because of the return statement in “int main”. I would suggest using “void main ()” instead of “int main ()”. But if you want to use “int main ()”, shift the “return 0” below the while statement. You also need to ask the user if he or she wants to continue. Try this: (Ignore the bad spacing)

int main () {
    do {
        cout << "Programma wat optelt, aftrekt, vermedigvuldigd en deelt. \n\n";

        cout << "Geef een opdracht (eg. 1 + 2): \n";
        cin >> a >> operation >> b;

        Input (a,b);

        cout << "Het antwoord is: " << result << endl;
        cout << "Press y to continue: ";
        cin >> yesNo;
    } while (yesNO == 'y');
    return 0;
}

3

solved where do i put the do-while loop in a calculator program [closed]