Guest User

Untitled

a guest
Apr 25th, 2012
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 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;
  15. int weight;
  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. }
  33.  
  34. qsort (Students[20].age,20, sizeof(int), compare); // i dont know what do with this
  35.  
  36.  
  37. for (n=0; n<NO_OF_STUDENTS; n++)
  38. printf ("%d ",values[NO_OF_STUDENTS]);
  39. return 0;
  40. }
  41.  
  42.  
  43. int compare (const void * a, const void * b)
  44. {
  45. return ( *(int*)a - *(int*)b );
  46. }
Advertisement
Add Comment
Please, Sign In to add comment