Guest User

Untitled

a guest
Apr 21st, 2012
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.99 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <conio.h>
  5. #include <stdlib.h>
  6.  
  7.  
  8. #define NO_OF_STUDENTS 20
  9.  
  10.  
  11. struct data
  12. {
  13.     char name[20];
  14.     int age[20];
  15.     int weight[20];
  16. };
  17.  
  18.  
  19.  
  20.  
  21. int main ()
  22. {
  23.     int n;
  24.     struct data Students[NO_OF_STUDENTS]; // 20 students.
  25.     int Counter = 0;
  26.  
  27.  for(; Counter < NO_OF_STUDENTS; ++Counter)
  28.     {
  29. Students[Counter].name[NO_OF_STUDENTS] = '\0'
  30. scanf("%s", Students[Counter].name);
  31.  
  32. Students[Counter].age[NO_OF_STUDENTS] = '\0';
  33. scanf("%d", Students[Counter].age);
  34.         Students[Counter].weight[NO_OF_STUDENTS] = '\0'; // Set the end of the string.
  35.         scanf("%d", Students[Counter].weight);
  36.     }
  37.  
  38.  
  39.     qsort (Students[20].age,20, sizeof(int), compare); // i dont know what do with this
  40.  
  41.  
  42.     for (n=0; n<NO_OF_STUDENTS; n++)
  43.         printf ("%d ",values[NO_OF_STUDENTS]);
  44.     return 0;
  45. }
  46.  
  47.  
  48. int compare (const void * a, const void * b)
  49. {
  50.     return ( *(int*)a - *(int*)b );
  51. }
Advertisement
Add Comment
Please, Sign In to add comment