Hello, I'm new to C++ and am trying to figure out how to make my program run over and over again until the user chooses to quit. Any advice would be appreciated. Thanks

#include <iostream>
#include <cstdlib>
#include <string>
#include <math.h>
#include <windows.h>

using namespace std;

int num1, num2;
float average;
float Sum;
float sub;
float multi;
float divi;

void getInput( );             
void calculateAverage( ); 
void writeAverage( ); 
void calculateSum ( );
void writeSum ( );
void subSum ( );
void writeSub ( );
void calculateMulti ( );
void writeMulti ( );
void calculateDivi ( );
void writeDivi ( );
int main()
                                           
{
                                           

                                           
system("title Calculator");
system("color F0");	 
       	            

       	            
getInput( );            
calculateAverage( );
writeAverage( );
calculateSum ( );
writeSum ( );
subSum ( );
writeSub ( );
calculateMulti ( );
writeMulti ( );
calculateDivi ( );
writeDivi ( );

	 
system("pause");
system("cls");
return 0;
		 	 
}


void getInput()
{
cout <<  "Welcome << endl;
cout <<"                               \n";

cout <<  "Type 2 numbers you want to average, separated by a space: ";
cin  >>  num1 >> num2;
}
void calculateAverage( )
{
average = (num1 + num2)/2.0;  
}
void writeAverage( )
{
cout << "The average is " << average << endl;


cout << "Type 2 numbers you want to add, separated by a space: ";
cin >> num1 >> num2;
}
void calculateSum ( )
{
Sum = num1 + num2;
}
void writeSum( )
{
cout << "The sum is " << Sum << endl;


cout << "Type 2 numbers you want to subtract, separated by a space: ";
cin >> num1 >> num2;
}
void subSum ( )
{
sub = num1 - num2;
}
void writeSub ( )
{
cout << "The product is " << sub << endl;

cout << "Type 2 numbers you want to multiply, separated by a space: ";
cin >> num1 >> num2;
}
void calculateMulti ( )
{
multi = num1 * num2;
}
void writeMulti ( )
{
cout << "The answer is " << multi << endl;

cout << "Type 2 numbers you want to divide, separated by a space: ";
cin >> num1 >> num2;
}
void calculateDivi ( )
{
divi = num1 / num2;
}
void writeDivi ( )
{
cout << "Your answer is " << divi << endl;


}

simply create an option for the user to choose...lets say switch case is the best way

I'm still pretty new to this so I'm not sure how to do that. I'll keep studying other examples of code.

Have you considered using a do{}while(); loop, where at the end of the loop you ask input from the user if he wishes to continue and check the same inside "while"

This article has been dead for over six months. Start a new discussion instead.