i have coded the program in such a way that untill the user types y key the program will not be terminated.
Code:
one question is asked that do you like the program(y/n?):
untill you press y it wont end.
but the problem is that i have to press y 2 times to terminate the programme or have to press n 2 times to make the statement appear again . what shall i do?
i have coded the program like this:
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
void main()
{
char y,n,option;
clrscr();
label:
cout<<"do u like the program(y/n?):";
cin>>option;
option=getchar();
if(option=='y')
{
cout<<"thnx";
cin.get();
getch();
}
else
goto label;
}
plzzz help.
thnx in advance.........