Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  5.  
  6. int main() {
  7. int y,x,choice;
  8. struct STUDENT {
  9.  
  10. char name[128];
  11. int id, age;
  12.  
  13.  
  14. };
  15.  
  16. struct STUDENT std[10];
  17.  
  18. printf ("Choose a Function!\n");
  19. printf ("1) Enter an entry\n");
  20. printf ("2) Display entries\n");
  21. printf ("3) Edit entry\n");
  22. printf ("4) Remove an entry\n");
  23. scanf ("%d", &choice);
  24.  
  25. switch (choice){
  26.  
  27. case 1:
  28. for (x=0;x<2;x++){
  29.  
  30. printf ("Enter name: ");
  31. scanf ("%s", &std[x].name);
  32.  
  33. printf ("Enter Age: ");
  34. scanf ("%d", &std[x].age);
  35.  
  36. printf ("Enter ID number: ");
  37. scanf ("%d", &std[x].id);
  38.  
  39. }return main;
  40. break;
  41. case 2:
  42.  
  43. for (x=0;x<2;x++){
  44.  
  45. printf ("\nName: %s", std[x].name);
  46. printf ("\nAge: %d", std[x].age);
  47. printf ("\nID number: %d", std[x].id);
  48.  
  49. }break;
  50. }
  51. return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement