do {
// stuff
do {
// ask user to enter C or c to continue, or Q or q to quit
// read user input HERE
} while( user input was not 'C', 'c', 'Q', or 'q' );
} while( user input from HERE was not 'Q' or 'q' );
your initial question was for the user to press Q or q to quit the initial Question.
anything other then q when asked to quit is entered the loop will repeat itself. but the program will pause till something is entered. you can prompt.
using your example of the whole program you could do this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include<iostream>
usingnamespace std;
int main()
{
char q;
do
{ int a;
cout <<"enter your number ";
cin>>a;
cout <<"press q to quit or c to continue";
cin >>q;
} while ( q=='q');
return 0 ;
}
that way the user will either press q or c and if q =q the the program will terminate else continue.