| | |
can you help me on this problem please?
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jan 2009
Posts: 4
Reputation:
Solved Threads: 0
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!
"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!
>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.
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
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.
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
•
•
Join Date: Jan 2009
Posts: 4
Reputation:
Solved Threads: 0
so if i write some of the code that i have in mind will you help me solve it?
•
•
•
•
so if i write some of the code that i have in mind will you help me solve it?
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
•
•
Join Date: Jan 2009
Posts: 4
Reputation:
Solved Threads: 0
•
•
•
•
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.
C Syntax (Toggle Plain Text)
#include <stdio.h> #include <string.h> #define N 100 #define M 6 main() { int i,j surname[N],name[N],ID[N],grade[M][N]; for (i=0; i<=N; i++) { printf("give name,surname,id of %d student",i+1); scanf("%s",name,surname,id) { for (j=0; j<=M; j++) printf("give grade for the %d lesson,j+1); scanf("%s",grade[i][j]); } if (grade [i][j]>0&&grade[i][j]<10) { for (i=0; i<N; i++) {sum=0; for (j=0; j<M; j++) sum=sum+grade[i][j]; avg=sum/6;
is ti correct so far?????????
>is ti correct so far?????????
No! Not at all.
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
•
•
Join Date: May 2008
Posts: 631
Reputation:
Solved Threads: 103
(*rats I wasn't first reply
*)
The format in
This for statement:
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]
*)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:
c Syntax (Toggle Plain Text)
for (j=0; j<=M; j++) printf("give grade for the %d lesson,j+1);
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]
![]() |
Similar Threads
- Problem with Windows Update and WinXP (Web Browsers)
- Installing Windows 98 On VMware. Floppy problem (Windows 95 / 98 / Me)
- Windows XP keeps restarting since a new video card (Windows NT / 2000 / XP)
- Redhat Linux 6.2 - ipop3d problem? (*nix Software)
- Problem with T720 (Cellphones, PDAs and Handheld Devices)
- Connection Problems (Networking Hardware Configuration)
- Encoding (Unicode) problem in IE 6.0 (Web Browsers)
- .htaccess mod_rewrite problem (Linux Servers and Apache)
- Javascript/HTML problem!!! (JavaScript / DHTML / AJAX)
Other Threads in the C Forum
- Previous Thread: numbers from file to array
- Next Thread: converting string to MAC address structure
| Thread Tools | Search this Thread |
Tag cloud for C
adobe ansi api array arrays asterisks binarysearch calculate centimeter char convert copyanyfile copyimagefile copypdffile cprogramme createcopyoffile csyntax directory drawing dynamic executable fflush file fork frequency getlasterror givemetehcodez graphics gtkgcurlcompiling hacking hardware highest homework i/o inches incrementoperators infiniteloop initialization interest km lazy linked linkedlist linux linuxsegmentationfault list locate logical_drives match matrix microsoft motherboard multi mysql number open opendocumentformat opensource owf pattern pdf performance pointer pointers posix power problem probleminc program programming pyramidusingturboccodes read recursion recv repetition scanf scheduling scripting segmentationfault send shape socketprograming spoonfeeding stack standard string strings structures student suggestions systemcall test testautomation unix user variable voidmain() wab win32api windows.h






