🔒 Closed Help po mga sir, baguhan palang po ako kaya diko alam pano ifix.

Status
Not open for further replies.

Mr_Ch3ck3r

Fanatic
1569641421729.webp

#include<stdio.h>
int main()
{
char menu, fname, lname, mname, age, gender, bday, sno, college, shs, jhs;
printf("Welcome To OLFU Alumni Registration System!!");
printf("\n\nHello, would you like to: \n");
printf("\n ____________________");
printf("\n| Please Choose! |");
printf("\n|____________________|");
printf("\n| |");
printf("\n| A.NEW |");
printf("\n| B.OLD |");
printf("\n| C.EXIT |");
printf("\n| |");
printf("\n|____________________|");
printf("\n PLEASE TYPE: ");
scanf("%s",&menu);
switch (menu){
case 'A':
printf("Please Fill Up The Following");
printf("\nFirst Name: ");
gets ("fname");
break;
case 'B':
printf("Please Type Your Alumni Id Number:");
break;
case 'C':
printf("Thank You For Using The OLFU Alumni Registration System");
break;
}

}
 
Nun mag-scanf ka dito:

C:
...
printf("\n PLEASE TYPE: ");
scanf("%s",&menu);

Nasa buffer pa din yung '\n' char. So para ma-consume yun, try to add getchar() past scanf like this:
C:
printf("\n PLEASE TYPE: ");
scanf("%s",&menu);
getchar();

Note: Don't use gets(). It is dangerous!
 
Status
Not open for further replies.

About this Thread

  • 3
    Replies
  • 483
    Views
  • 3
    Participants
Last reply from:
homer_simpson

Trending Topics

Online now

Members online
335
Guests online
579
Total visitors
914

Forum statistics

Threads
2,274,597
Posts
28,957,097
Members
1,234,335
Latest member
Unplugged18
Back
Top