Hi, I've written the code below and everything works fine, but my question is how can I loop everything to ask the user if they wish to enter another set of packets sent instead of having to run the program over and over again?
//Write a program that asks for the post name (a string) and the packets per second each post sends to GC3.
//The program should then display the PCL of the post.
#include<iostream>
#include<string>
usingnamespace std;
int main()
{
//Declarations
string name;
double packetsPerSecSent = 0.0;
//Asking the user for input
cout << "Please enter Post name: ";
getline(cin, name);
cout << "Please enter the number of packets per second each post sends to GC3: ";
cin >> packetsPerSecSent;
//Using if statements to test each condition depending on user input
if (packetsPerSecSent >= 10000)
{
cout << "\nPacket Communication: Level I" << endl;
}
elseif (5000 < packetsPerSecSent && packetsPerSecSent <= 10000)
{
cout << "\nPacket Communication: Level II " << endl;
}
elseif (1000 < packetsPerSecSent && packetsPerSecSent <= 5000)
{
cout << "\nPacket Communication: Level III " << endl;
}
elseif (packetsPerSecSent <= 1000)
{
cout << "\nPacket Communication: Level I " << endl;
}
//End of program
cout << "Please press ENTER to end program.";
cin.sync();
getchar();
return 0;
}