Advertisement
pdaogu

Ex5.2

Oct 6th, 2018
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.88 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. #define N 1000
  4.  
  5. int main () {
  6.     int day[N], month[N], year[N],
  7.         minBegin[N], hrBegin[N],
  8.         minEnd[N], hrEnd[N];
  9.     char cls[N][30], subject[N][100];
  10.     char isStop = 'y';
  11.     int i = 0;
  12.     while (isStop != 'n' && isStop != 'N') {
  13.         printf("\nPlease enter the class' info:\n");
  14.         printf("Date: ");
  15.         scanf("%d%*c%d%*c%d", &day[i], &month[i], &year[i]);
  16.         while (getchar() != '\n');
  17.         printf("Class name: ");
  18.         scanf("%[^\n]", cls[i]);
  19.         while (getchar() != '\n');
  20.         printf("Subject name: ");
  21.         scanf("%[^\n]", subject[i]);
  22.         while (getchar() != '\n');
  23.         printf("Begin time (e.g: 8:30): ");
  24.         scanf("%d%*c%d", &minBegin[i], &hrBegin[i]);
  25.         while (getchar() != '\n');
  26.         printf("Finish time (e.g: 8:30): ");
  27.         scanf("%d%*c%d", &minEnd[i], &hrEnd[i]);
  28.         while (getchar() != '\n');
  29.         printf("Do you want to continue? ([Y]es/[N]o) ");
  30.         isStop = getchar();
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement