[ create a new paste ] login | about

Link: http://codepad.org/4uFIh437    [ raw code | output | fork ]

C, pasted on Jun 6:
#include <stdio.h>
#include <time.h>
#define MAX 100;
#define N 10;
enum {true, false};
typedef char mystring[] ;
void sequentialPrint(mystring s[], int);

void main(){
   int i;
   int n;
   mystring s[N];

   printf("Kiem tra giua ky 20192\n");
   printf("Nhap so chuoi (tu 1 den 10):");
   scanf("%d", n);
   printf("Nhap lan luot cac chuoi\n");
   for (i=0;i<n;i++){
     printf("s[%s]=",i);
     scanf("%s", s[i]);
   }

    sequentialPrint(s, n);

}

void sequentialPrint(mystring s, int N){
   clock_t beginTime, endTime;
   clock_t period = 500;
   int i = 0;
   int c;
   beginTime = clock();
   while (true){
       if (kbhit()){
          c = getch();
          if (c == 27) break;
          else if (c == 'a') {
                if (period > 100) period += 10;
          }
          else if (c == 'd') if (period <2000) period -= 10;
       }
       endTime = clock();
       if (endTime-beginTime>period){
          beginTime = endTime;
          printf("%s ", s[i]);
          if (i==(n-1)) printf("\n");
          i = (i+1) % n;
       }
   }
}


Output:
1
2
3
4
5
6
7
8
9
10
Line 7: error: array type has incomplete element type
In function 'main':
Line 12: error: expected ']' before ';' token
Line 20: error: 's' undeclared (first use in this function)
Line 20: error: (Each undeclared identifier is reported only once
Line 20: error: for each function it appears in.)
Line 23: error: type of formal parameter 1 is incomplete
Line 9: warning: return type of 'main' is not 'int'
t.c: At top level:
Line 27: error: expected ';', ',' or ')' before numeric constant


Create a new paste based on this one


Comments: