can you help me on this problem please?

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jan 2009
Posts: 4
Reputation: sotiris25s is an unknown quantity at this point 
Solved Threads: 0
sotiris25s sotiris25s is offline Offline
Newbie Poster

can you help me on this problem please?

 
0
  #1
Jan 22nd, 2009
i have exams tomorrow and i really really need someones help on my problem. here how it goes:

"we have 100 students info such as surname,name,id and grades for 6 lessons for those students.
the program must:

- can take grades from 1 to 10
- can calculate and find which students have average above 5
- we should give the surname of the student and then show us the max grade of that student
- the program will finish when we type the word "end"

please give me all your help i need this soo much its my exams tomorrow and i really need help.thanks in advance!
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 2,048
Reputation: Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of 
Solved Threads: 178
Aia's Avatar
Aia Aia is offline Offline
Postaholic

Re: can you help me on this problem please?

 
0
  #2
Jan 22nd, 2009
>please give me all your help i need this soo much its my exams tomorrow and i really need help.thanks in advance!

Sure, tell me the e-mail of your professor at school and I'll ask him to give you a break.
"If it moves, tax it. If it keeps moving, regulate it, and if it stops moving, subsidize it" - Ronald Reagan
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 4
Reputation: sotiris25s is an unknown quantity at this point 
Solved Threads: 0
sotiris25s sotiris25s is offline Offline
Newbie Poster

Re: can you help me on this problem please?

 
0
  #3
Jan 22nd, 2009
Originally Posted by Aia View Post
>Sure, tell me the e-mail of your professor at school and I'll ask him to give you a break.
just help me if you can and leave the emails for tomorrow
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 2,048
Reputation: Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of 
Solved Threads: 178
Aia's Avatar
Aia Aia is offline Offline
Postaholic

Re: can you help me on this problem please?

 
0
  #4
Jan 22nd, 2009
Originally Posted by sotiris25s View Post
just help me if you can and leave the emails for tomorrow
Are you this moronic by birth or do you practice day by day?
Don't you remember when your teacher told you that cheating was not good for you?

We don't give school assignment solutions. You would have known that, if you took the time to read the rules of this forum.
Last edited by Aia; Jan 22nd, 2009 at 6:52 pm. Reason: Changing a word.
"If it moves, tax it. If it keeps moving, regulate it, and if it stops moving, subsidize it" - Ronald Reagan
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 4
Reputation: sotiris25s is an unknown quantity at this point 
Solved Threads: 0
sotiris25s sotiris25s is offline Offline
Newbie Poster

Re: can you help me on this problem please?

 
0
  #5
Jan 22nd, 2009
Originally Posted by Aia View Post
Are you this moronic by birth or do you practice day by day?
Don't you remember when your teacher told you that cheating was not good for you?

We don't give school assignment solutions. You would have known that, if you took the time to read the rules of this forum.
so if i write some of the code that i have in mind will you help me solve it?
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 2,048
Reputation: Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of 
Solved Threads: 178
Aia's Avatar
Aia Aia is offline Offline
Postaholic

Re: can you help me on this problem please?

 
0
  #6
Jan 22nd, 2009
Originally Posted by sotiris25s View Post
so if i write some of the code that i have in mind will you help me solve it?
The premise behind this forum is this; to help people that help themselves.
I doubt you make the cut. However, you will always be "encouraged" to show your efforts and to make explicit where you are having troubles with.
Last edited by Aia; Jan 22nd, 2009 at 7:08 pm.
"If it moves, tax it. If it keeps moving, regulate it, and if it stops moving, subsidize it" - Ronald Reagan
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 4
Reputation: sotiris25s is an unknown quantity at this point 
Solved Threads: 0
sotiris25s sotiris25s is offline Offline
Newbie Poster

Re: can you help me on this problem please?

 
0
  #7
Jan 22nd, 2009
Originally Posted by Aia View Post
The premise behind this forum is this; to help people that help themselves.
I doubt you make the cut. However, you will always be "encouraged" to show your efforts and to make explicit where you are having troubles with.
  1. #include <stdio.h>
  2. #include <string.h>
  3. #define N 100
  4. #define M 6
  5. main()
  6. {
  7. int i,j surname[N],name[N],ID[N],grade[M][N];
  8.  
  9. for (i=0; i<=N; i++)
  10. { printf("give name,surname,id of %d student",i+1);
  11. scanf("%s",name,surname,id)
  12. {
  13. for (j=0; j<=M; j++)
  14. printf("give grade for the %d lesson,j+1);
  15. scanf("%s",grade[i][j]);
  16. }
  17. if (grade [i][j]>0&&grade[i][j]<10)
  18. {
  19. for (i=0; i<N; i++)
  20. {sum=0;
  21. for (j=0; j<M; j++)
  22. sum=sum+grade[i][j];
  23. avg=sum/6;
  24.  

is ti correct so far?????????
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 2,048
Reputation: Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of 
Solved Threads: 178
Aia's Avatar
Aia Aia is offline Offline
Postaholic

Re: can you help me on this problem please?

 
0
  #8
Jan 22nd, 2009
>is ti correct so far?????????
No! Not at all.
int i,j, surname[N],name[N],ID[N],grade[M][N]; Tell me! What type should be the memory that will hold a name or surname? And grade?

scanf("%s",name,surname,id) Three type of variables, but I only see one "%s" format operator.

scanf("%s",grade[i][j]); At best, grade[i][j] would be a single char or int, which can not receive a formatted "%s".
"If it moves, tax it. If it keeps moving, regulate it, and if it stops moving, subsidize it" - Ronald Reagan
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 631
Reputation: Murtan is a jewel in the rough Murtan is a jewel in the rough Murtan is a jewel in the rough Murtan is a jewel in the rough 
Solved Threads: 103
Murtan Murtan is offline Offline
Practically a Master Poster

Re: can you help me on this problem please?

 
0
  #9
Jan 22nd, 2009
(*rats I wasn't first reply *)

int i,j surname[N],name[N],ID[N],grade[M][N]; Declares all of those variables as integer. Should some of them have character data?

The format in scanf("%s",name,surname,id) will only read one string value. surname and id will be empty. (But as noted above, name, surname and id are all integers anyway.)

This for statement:
  1. for (j=0; j<=M; j++)
  2. printf("give grade for the %d lesson,j+1);
  3.  
does not have any braces on it and so will loop only the first statement.

You don't have enough matching braces yet, could you try to compile it and post code that compiles?

and when posting c code, please use c code tags
[code=c]
/* Your code here */
[/code]
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 90
Reputation: ajay.krish123 is an unknown quantity at this point 
Solved Threads: 8
ajay.krish123 ajay.krish123 is offline Offline
Junior Poster in Training

Re: can you help me on this problem please?

 
0
  #10
Jan 23rd, 2009
@ sotiris25s
You need to go basics throughly.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C Forum
Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC