943,936 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 4738
  • C RSS
You are currently viewing page 1 of this multi-page discussion thread
Jun 3rd, 2004
0

Many Errors while doing this assignment

Expand Post »
I'm a fresh in writting C program...
still learning n hav struggling with it~~
could anyone give me some hints to complete it?
--------------------------------------------------------------------------

Create an application, which helps manage the in-course assessments of an intake in COLLEGE X. This program is meant for lecturers to key-in and view, the marks of any assessment of the students. Take the assessments planned for an arbitrary intake of 15 students and design a system whereby marks can be entered and viewed for all 15 students.

The menus below would help you understand the requirements of the system.



Main menu

FF0342 In-course Assessments

1.Test 1
2.Assignment
3.Test 2
4.EXIT program

Choice:_

--------------------------------------------------------------------

Test 1

1.Enter marks
2.View marks
3.Back to Main Menu

Choice:_

-------------------------------------------------------------------------

Similar screens must be provided for the Assignment and Test 2. The program should be made to exit only from the main menu.

For Enter marks option, the user must be given a prompt after entering a student’s mark to continue or to go back to the previous menu. Therefore, the user need not enter ALL marks in one go. The View marks option must display all the marks entered so far, for the particular assessment.

Note: The program must not take in marks for more than the stated 15 students.

Your program must be modular, user-friendly using all efficient programming techniques. Global variables can be declared provided their usage in all the functions declared below it, is justified. There should be no need for graphics in your program, as what is being assessed, is your programming skills not the interface design.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Robin Low is offline Offline
8 posts
since Jun 2004
Jun 3rd, 2004
0

Re: Many Errors while doing this assignment

hey man we dont so assignment for students you must learn then do efforts then we can help you ..
Team Colleague
Reputation Points: 55
Solved Threads: 3
Junior Poster
meabed is offline Offline
139 posts
since May 2004
Jun 3rd, 2004
0

Re: Many Errors while doing this assignment

hmmmm...i didn't mean like that.Just to hope i may get some hints while doing it.
cause it really stuck me at the middle......
anyway....is it any tutorials for dummies in stead of buying books?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Robin Low is offline Offline
8 posts
since Jun 2004
Jun 3rd, 2004
0

Re: Many Errors while doing this assignment

Hello,

I hope that is not your social security number as a username. If so, please have it changed. One thing I did wrong in college was let my number float out on checks, and well, that was just dumb!

Anyway, your program is going to need a few things:

1) functions to draw out the menus and deal with the input.
2) A storage unit (called a structure) to handle the student numbers and marks for both exams

  1. struct studata
  2. {
  3. int student_number;
  4. int test1_mark;
  5. int test2_mark;
  6. }

3) Need to error check your input fields. What if a user types in a letter, when there should have been a number? Something along the lines of 1 < X < 4 so that the program does not go nuts on bad data.

Break up the program, so that each "phase" is done in a function. Then, in your main() part of the program, setup a loop until the program is told to "exit".

Write this thing up. Do some psuedo code if you would like, and we would be happy to look at it from there. If you do post it, keep any personal information, such as your social or phone number, off of the text. We have seen a few people placing their social numbers on the website, and that is dangerous.

Christian
Team Colleague
Reputation Points: 121
Solved Threads: 57
Posting Virtuoso
kc0arf is offline Offline
1,629 posts
since Mar 2004
Jun 7th, 2004
0

Re: Many Errors while doing this assignment

i'll try it myself.....
but i afraid i don't have enough time to comprehend all,as the due will be on Tuesday(Malaysia)...
i apologize to my broken english if u guys feel hard to comprehend my english...
anyway....thanks for helping...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Robin Low is offline Offline
8 posts
since Jun 2004
Jun 7th, 2004
0

Re: Many Errors while doing this assignment

yea,change you nick.It's hard to think of a number as a human you know.

New to the internet?I agree with kc0arf it is a very bad idea to let your details float around.People can/will put it to misuse(especially on the internet[Take it from a guy who has gone real deep into security]).
Reputation Points: 108
Solved Threads: 7
Posting Whiz in Training
FireNet is offline Offline
256 posts
since May 2004
Jun 7th, 2004
0

Re: Many Errors while doing this assignment

hmmmm...how can i change my nick?
i can't find such an option at the User's Control Panel..
must inform to the admin?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Robin Low is offline Offline
8 posts
since Jun 2004
Jun 7th, 2004
0

Re: Many Errors while doing this assignment

i've referenced my friend's code and written myself one.
but this code seems to have problem while executing.......

  1. #include<stdio.h>
  2. main(){
  3. int choice, choiceT1, i, a[15],plus,choiceA1,choiceT2;
  4. char ans;
  5. printf("\t\t\t\tMain menu\n\n");
  6. printf("\t\t\tFF0342 In-course Assessments\n\n");
  7. printf("\t\t\t\t 1. Test1\n");
  8. printf("\t\t\t\t 2. Assignment\n");
  9. printf("\t\t\t\t 3. Test 2\n");
  10. printf("\t\t\t\t 4. EXIT program\n\n");
  11. printf("\t\t\t\t Choice:");
  12. scanf("%d",&choice);
  13. i = 0;
  14. plus = 0;
  15.  
  16. while( choice != 4 ) {
  17.  
  18. if(choice==1){
  19. printf("\t\t\t\tTest1\n\n");
  20. printf("\t\t\t 1. Enter marks\n");
  21. printf("\t\t\t 2. View marks\n");
  22. printf("\t\t\t 3. Back to Main Menu\n\n");
  23. printf("\t\t\t\t Choice:");
  24. scanf("%d",&choiceT1);
  25. if(choiceT1 == 3)
  26. return main();
  27.  
  28.  
  29. while( choice != 3 ) {
  30.  
  31. if(choiceT1==1) {
  32. while (ans != 'n'){
  33. printf("Enter Mark: ");
  34. scanf("%d",&a[i]);
  35. i++;
  36. plus++;
  37. printf("Do you want to continue (Y/N)?");
  38. scanf("%s",&ans);
  39. if (i==15){
  40. ans = 'n';
  41.  
  42.  
  43. }
  44.  
  45. }
  46. }
  47. else
  48. {
  49. if(choiceT1 == 2) {
  50. for(i=0; i<plus; i++)
  51. printf("Mark : %d\n\n", a[i] );
  52. }
  53. }
  54. printf("\t\t\t\tTest1\n\n");
  55. printf("\t\t\t 1. Enter marks\n");
  56. printf("\t\t\t 2. View marks\n");
  57. printf("\t\t\t 3. Back to Main Menu\n\n");
  58. printf("\t\t\t\t Choice:");
  59. scanf("%d",&choiceT1);
  60. if( i < 15 )
  61. ans = 'y';
  62. else
  63. ans = 'n';
  64.  
  65. if(choiceT1 == 3){
  66. return main();
  67. }
  68. }
  69. }
  70. }
  71. while( choice != 4 ) {
  72.  
  73. if(choice==2){
  74. printf("\t\t\t\tAssigment\n\n");
  75. printf("\t\t\t 1. Enter marks\n");
  76. printf("\t\t\t 2. View marks\n");
  77. printf("\t\t\t 3. Back to Main Menu\n\n");
  78. printf("\t\t\t\t Choice:");
  79. scanf("%d",&choiceA1);
  80. if(choiceA1 == 3)
  81. return main();
  82.  
  83.  
  84. while( choice != 3 ) {
  85.  
  86. if(choiceA1==1) {
  87. while (ans != 'n'){
  88. printf("Enter Mark: ");
  89. scanf("%d",&a[i]);
  90. i++;
  91. plus++;
  92. printf("Do you want to continue (Y/N)?");
  93. scanf("%s",&ans);
  94. if (i==15){
  95. ans = 'n';
  96.  
  97.  
  98. }
  99.  
  100. }
  101. }
  102. else
  103. {
  104. if(choiceA1 == 2) {
  105. for(i=0; i<plus; i++)
  106. printf("Mark : %d\n\n", a[i] );
  107. }
  108. }
  109. printf("\t\t\t\tAssigment\n\n");
  110. printf("\t\t\t 1. Enter marks\n");
  111. printf("\t\t\t 2. View marks\n");
  112. printf("\t\t\t 3. Back to Main Menu\n\n");
  113. printf("\t\t\t\t Choice:");
  114. scanf("%d",&choiceA1);
  115. if( i < 15 )
  116. ans = 'y';
  117. else
  118. ans = 'n';
  119.  
  120. if(choiceA1 == 3){
  121. return main();
  122. }
  123. }
  124. }
  125. }
  126. while( choice != 4 ) {
  127.  
  128. if(choice==3){
  129. printf("\t\t\t\tTest2\n\n");
  130. printf("\t\t\t 1. Enter marks\n");
  131. printf("\t\t\t 2. View marks\n");
  132. printf("\t\t\t 3. Back to Main Menu\n\n");
  133. printf("\t\t\t\t Choice:");
  134. scanf("%d",&choiceT2);
  135. if(choiceT2 == 3)
  136. return main();
  137.  
  138.  
  139. while( choice != 3 ) {
  140.  
  141. if(choiceT2==1) {
  142. while (ans != 'n'){
  143. printf("Enter Mark: ");
  144. scanf("%d",&a[i]);
  145. i++;
  146. plus++;
  147. printf("Do you want to continue (Y/N)?");
  148. scanf("%s",&ans);
  149. if (i==15){
  150. ans = 'n';
  151.  
  152.  
  153. }
  154.  
  155. }
  156. }
  157. else
  158. {
  159. if(choiceT2 == 2) {
  160. for(i=0; i<plus; i++)
  161. printf("Mark : %d\n\n", a[i] );
  162. }
  163. }
  164. printf("\t\t\t\tTest2\n\n");
  165. printf("\t\t\t 1. Enter marks\n");
  166. printf("\t\t\t 2. View marks\n");
  167. printf("\t\t\t 3. Back to Main Menu\n\n");
  168. printf("\t\t\t\t Choice:");
  169. scanf("%d",&choiceT2);
  170. if( i < 15 )
  171. ans = 'y';
  172. else
  173. ans = 'n';
  174.  
  175. if(choiceT2 == 3){
  176. return main();
  177. }
  178. }
  179. }
  180. }
  181. return main();
  182. }
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Robin Low is offline Offline
8 posts
since Jun 2004
Jun 7th, 2004
0

Re: Many Errors while doing this assignment

  1. #include<stdio.h>
  2. main(){
  3. int Choice , Choice_test1 , Assignment , Choice_test2 , i , counter=0;
  4. int a[15] , b[15] , c[15];
  5. printf("\n\n\t\t\t\tMain menu\n\n");
  6. printf("\t\t\tFF0342 In-course Assessments\n\n");
  7. printf("\t\t\t\t1. Test 1\n");
  8. printf("\t\t\t\t2. Assignment\n");
  9. printf("\t\t\t\t3. Test 2\n");
  10. printf("\t\t\t\t4. EXIT program\n\n");
  11. printf("\t\t\t\tChoice:");
  12. scanf("%d",&Choice);
  13.  
  14. while (1<=Choice<4){
  15.  
  16. if (Choice==1){
  17. printf("\n\n\t\t\t\tTest 1\n\n");
  18. printf("\t\t\t1. Enter marks\n");
  19. printf("\t\t\t2. View marks\n");
  20. printf("\t\t\t3. Back to Main Menu\n\n");
  21. printf("\t\t\t\tChoice:");
  22. scanf("%d", &Choice_test1);
  23. if (Choice_test1==3)
  24. return main();
  25.  
  26. while (1<=counter<3){
  27. if (Choice_test1==1){
  28. for (i=0;i<15;i++){
  29. printf("Enter student's mark:");
  30. scanf("%d", &a[i] );
  31. }
  32. }
  33. else{
  34. if (Choice_test1==2){
  35. for (i=0;i<15;i++)
  36. printf("Student's mark:%d\n\n", a[i]);
  37.  
  38. }
  39. }
  40. printf("\n\n\t\t\t\tTest 1\n\n");
  41. printf("\t\t\t1. Enter marks\n");
  42. printf("\t\t\t2. View marks\n");
  43. printf("\t\t\t3. Back to Main Menu\n\n");
  44. printf("\t\t\t\tChoice:");
  45. scanf("%d", &Choice_test1);
  46. if (Choice_test1==3)
  47. return main();
  48. }
  49.  
  50. }
  51.  
  52.  
  53. if (Choice==2){
  54. printf("\n\n\t\t\t\tAssignment\n\n");
  55. printf("\t\t\t1. Enter marks\n");
  56. printf("\t\t\t2. View marks\n");\
  57. printf("\t\t\t3. Back to Main Menu\n\n");
  58. printf("\t\t\t\tChoice:");
  59. scanf("%d",&Assignment);
  60. if (Assignment==3)
  61. return main();
  62.  
  63. while (1<=counter<3){
  64. if (Assignment==1){
  65. for (i=0;i<15;i++){
  66. printf("Enter student's mark:");
  67. scanf("%d", &b[i] );
  68. }
  69. }
  70. else{
  71. if (Assignment==2){
  72. for (i=0;i<15;i++)
  73. printf("Student's mark:%d\n\n", b[i]);
  74.  
  75. }
  76. }
  77. printf("\n\n\t\t\t\tAssignment\n\n");
  78. printf("\t\t\t1. Enter marks\n");
  79. printf("\t\t\t2. View marks\n");
  80. printf("\t\t\t3. Back to Main Menu\n\n");
  81. printf("\t\t\t\tChoice:");
  82. scanf("%d", &Assignment);
  83. if (Assignment==3)
  84. return main();
  85. }
  86.  
  87. }
  88.  
  89. if (Choice==3){
  90. printf("\n\n\t\t\t\tTest 2\n\n");
  91. printf("\t\t\t1. Enter marks\n");
  92. printf("\t\t\t2. View marks\n");
  93. printf("\t\t\t3. Back to Main Menu\n\n");
  94. printf("\t\t\t\tChoice:");
  95. scanf("%d", &Choice_test2);
  96. if (Choice_test2==3)
  97. return main();
  98.  
  99. while (1<=counter<3){
  100. if (Choice_test2==1){
  101. for (i=0;i<15;i++){
  102. printf("Enter student's mark:");
  103. scanf("%d", &c[i] );
  104. }
  105. }
  106. else{
  107. if (Choice_test2==2){
  108. for (i=0;i<15;i++)
  109. printf("Student's mark:%d\n\n", c[i]);
  110.  
  111. }
  112. }
  113. printf("\n\n\t\t\t\tTest 2\n\n");
  114. printf("\t\t\t1. Enter marks\n");
  115. printf("\t\t\t2. View marks\n");
  116. printf("\t\t\t3. Back to Main Menu\n\n");
  117. printf("\t\t\t\tChoice:");
  118. scanf("%d", &Choice_test2);
  119. if (Choice_test2==3)
  120. return main();
  121. }
  122.  
  123. }
  124. }
  125.  
  126. return 0;
  127. }

i'm using this "while (1<=Choice<4)",but it shown few warnings....
how can i solve this?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Robin Low is offline Offline
8 posts
since Jun 2004
Jun 12th, 2004
0

Re: Many Errors while doing this assignment

Try

  1.  
  2. while(Choice >= 1 && Choice <4)

Solve troubles ?
Reputation Points: 108
Solved Threads: 7
Posting Whiz in Training
FireNet is offline Offline
256 posts
since May 2004

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.
This thread is currently closed and is not accepting any new replies.
Previous Thread in C Forum Timeline: Slow CPU causes damage to robot
Next Thread in C Forum Timeline: Please help with my quicksort





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


Follow us on Twitter


© 2011 DaniWeb® LLC