guys, I need my program to repeat itself again after we do any step.EX Once I run my program the menu will pops up, I will press 1 and I will enter the code than I need the menu to pops up again without running the program again. I don't know how to use the while loop?
Code:
#include <iostream>
#include <cctype>
#include<string>
using namespace std;
void newCode();
void printCode();
int main()
{
int tester;
cout << "select one of these options\n";
cout << "(1) Insert a new code\n";
cout << "(2) Print the data\n";
cout << "(3) Exit the program\n";
cin >> tester;
if(tester==1)
newCode();
else if (tester==2)
printCode();
/* else if (tester==3)
else
cout << "ERROR!!! You must choose one of the options from 1 to 3";*/
return 0;
}
void newCode()
{
string serial_number;
int length;
cout<< "please enter a serial number of 12 characters:";
cin >> serial_number;
length = serial_number.length();
if (length!=12 )
cout << "The code you have entered cannot be processed because the code must 12 characters exactly";
else
cout << "The serial number is:/n/" << serial_number;
}
void printCode()
{
string serial_number;
cout<< serial_number;
}