943,962 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 1195
  • C RSS
Oct 31st, 2006
0

frequency problem,can u plz do the documentation for mi

Expand Post »
/*QUESTION 2*/
  1. /*Program to compute frequency of a list of marks obtained by a group of students*/
  2. #include <stdio.h>
  3. #define SIZE 100
  4. main()
  5. {
  6. /*define n as number of students.x[SIZE] is a array to store marks of students*/
  7. /*tempo[SIZE] is also used to store marks, but used in computation for frequency*/
  8. /*In tempo[SIZE], elements are first arranged in ascending order to facilitate
  9.   the computation of frequency*/
  10. int i, j, n, temp, x[SIZE], tempo[SIZE];
  11. /*read in the value of n, the number of students*/
  12. printf("\n How many students?");
  13. scanf("%d", &n);
  14. printf("\n\n");
  15. /*Ask user to input marks*/
  16. for(i=0; i<n;++i){
  17. printf(" MARKS %d:", i+1);
  18. scanf("%d",&x[i]);
  19. tempo[i] = x[i];
  20. printf("\n");
  21. } /*End of for loop*/
  22.  
  23. /*display for frequency*/
  24. /*reorder all array elements in ascending order*/
  25. for(i=0; i<n-1; ++i){ /*beginning of outer for loop*/
  26. /*find the smallest of all the remaining elements*/
  27. for(j=i+1; j<n; ++j){ /*beginning of inner for loop*/
  28.  
  29. if(tempo[j]<tempo[i]){
  30. /*interchange two elements*/
  31. temp = tempo[i];
  32. tempo[i] = tempo[j];
  33. tempo[j] = temp;
  34. } /*end of if statement*/
  35. } /*end of inner for loop*/
  36. } /*end of outer for loop*/
  37. /*computation of frequency*/
  38. printf("\t");
  39. return 0;
  40. }
Last edited by Salem; Oct 31st, 2006 at 2:59 am. Reason: Added code tags, learn to use them yourself
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
neeven is offline Offline
6 posts
since Oct 2006
Oct 31st, 2006
0

Re: frequency problem,can u plz do the documentation for mi

Arent the comments clear enough to make so that you can yourself do the documentation ?
Super Moderator
Featured Poster
Reputation Points: 3233
Solved Threads: 720
Failure as a human
~s.o.s~ is offline Offline
8,872 posts
since Jun 2006
Oct 31st, 2006
0

Re: frequency problem,can u plz do the documentation for mi

sorry i sent the wrong code..anyways can u help me...can u tell me another way of solvin this problem...this program allows input of number of students,marks for each student,the frequency for each mark, the interval between identical marks...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
neeven is offline Offline
6 posts
since Oct 2006
Oct 31st, 2006
0

Re: frequency problem,can u plz do the documentation for mi

if you posted the wrong code then you need to post the correct code. We don't care if the code you posted doesn't work. Post the code you know how to do then we can talk about how to complete the assignment.

by "mark" do you mean "grade" ?

>>the interval between identical marks
what exactly does that mean?
Last edited by Ancient Dragon; Oct 31st, 2006 at 11:17 pm.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,953 posts
since Aug 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: Using TObject *Sender
Next Thread in C Forum Timeline: Need Help With Printing Pascal's Triangle In C





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC