Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. int high(int res[][]);
  2. int main(int argc, char *argv[])
  3. {
  4. char *topics[5] = {"World Peace ","Starvation ","Price of Gas ","Drilling for oil ","legilizing marajuana"};
  5. int x,j,top,result,averages,highest,lowest;
  6. int responses[5][10] = {0};
  7. int tmp[5][3] = {0}; //one average per topic
  8. char average[5] = {0};
  9. //float result;
  10. // int highest[5][3] = {0}; //same :)
  11. // int lowest [5][3] = {0}; //
  12. for(top = 0;top<5;top++)
  13. {
  14. for(x=0;x<3;x++)
  15. { printf("Person %d how do u feel about %s\n",x,topics[top]);
  16. scanf("%d",&result);
  17. tmp[top][x] = result;
  18. responses[top][result-1] += 1;
  19. }
  20. }
  21. //average
  22. for (top = 0;top!=4; top++)
  23. { // avg1 = tmp[top][x];
  24. average[top+1] =((tmp[top][x]+tmp[top][x+1]+tmp[top][x+2])/3 ) ;
  25. }
  26.  
  27.  
  28. //print
  29. for(top=0;top<5;top++)
  30. {
  31. printf("\n");
  32. printf("%s",topics[top]);
  33. for(x=0;x<9;x++)
  34. {
  35. printf("%d",responses[top][x]);
  36. }
  37. printf("ave = %d",average[top]);
  38. }
  39. system("PAUSE");
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement