Skipping part of the code.
Hey, I wrote a simple prog. that is asking 2 questions and then a question with Y/N answer.. but when the first 2 questions are asked, the program skip the Y/N question and jump down to return 0; and quit.
(And yes, I use cin instead of scanf, because scanf is.. just stupid)
Please help :P
Code:
int main()
{
char Fname[30];
char Ename[30];
char c;
printf("Please enter the first name of the admin\n: ");
cin >> Fname;
printf("Please enter the surname\n: ");
cin >> Ename;
printf("Is the name %s correct? (Y/N)\n: ", Fname,Ename);
c=getchar();
if(c=='Y' || c=='y')
{
printf("Welcome Mr.%s", Ename);
}
else
{
printf("Okey then.");
}
return 0;
}