943,880 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 2156
  • C RSS
You are currently viewing page 1 of this multi-page discussion thread
Jul 24th, 2008
0

can anyone help me with this C program?

Expand Post »
Description of tasks:
You are required to write a program that will calculate the total marks and the grade the student obtained on a multiple choice test paper. There are 20 questions and each question has an option A,B,C and D. Total of 30 students took the test. The correct answers are stored in an array form as the following:-

char answers[] = {“DAACBBCADCBAABDCDADD”};

The student’s name , matrix number and their answers are stored in a file called answers.dat in the following format:

Phavan 010896 AAACDBBBACDABCDDDADD
Fehreed 170208 DABCBBCADCDABDDDCADD

Each correct question carries 5 marks. The grade obtained is based on the criteria below:-

Marks Grade
100 to 70 - A
69 to 60 - B
59 to 50 - C
49 to 40 - D
39 and below - F


Problem Statement

Write a program that will display the following :-

1) the total marks and grade for each student
2) total number of students for each grade
3) percentage of passes and failures.


Read the data from the file answers.txt and calculate the marks and determine the grade the student obtained. Store the results in another file called results.txt in the following format. The records must be sorted based on the name.


Report on the CSC202 test

Name Matrix Number Total Marks Grade
Ali 1225 90 A
Dave 1227 87 A
Chen 1300 69 B
……
……

Total number of students who scored A : 5
Total number of students who scored B : 6
Total number of students who scored C : .10
Total number of students who scored D :5
Total number of students who scored F :4

Passes : 80%
Failures : 20%


..........................................................................................................

Thanks in advance
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
dapcigar is offline Offline
6 posts
since Jul 2008
Jul 24th, 2008
1

Re: can anyone help me with this C program?

Yes, we can help, but I see no program to help.

We help - we do not *do* the homework for you.
Reputation Points: 416
Solved Threads: 181
Nearly a Posting Virtuoso
Adak is offline Offline
1,463 posts
since Jun 2008
Jul 27th, 2008
0

Re: can anyone help me with this C program?

this is certainly homework, Why do you actually choose to have this at school if you don't want to take the time write your algorythms?

i'll give you a start:
Quote ...
#include <fstream>
#include <iostream>
using namespace std;

int main(){
// all you have to do is this part
return 0;
}
Reputation Points: 24
Solved Threads: 8
Junior Poster in Training
Tigran is offline Offline
90 posts
since Jun 2008
Jul 27th, 2008
0

Re: can anyone help me with this C program?

>i'll give you a start:
That's not a C program.
Learn how to properly use C programming tags.
Aia
Reputation Points: 2224
Solved Threads: 218
Nearly a Posting Maven
Aia is offline Offline
2,304 posts
since Dec 2006
Jul 27th, 2008
0

Re: can anyone help me with this C program?

Thanks

I'll try to use them from now on, didn't know it before, so thanks again

-Tigran
Reputation Points: 24
Solved Threads: 8
Junior Poster in Training
Tigran is offline Offline
90 posts
since Jun 2008
Jul 27th, 2008
0

Re: can anyone help me with this C program?

Haha, here we have one more homeword thread?

Dapsigar, show us a bit of progress on this assignment. You could expect some more help!

ssharish
Reputation Points: 73
Solved Threads: 20
Posting Whiz in Training
ssharish2005 is offline Offline
253 posts
since Dec 2006
Jul 27th, 2008
1

Re: can anyone help me with this C program?

Quote ...
The records must be sorted based on the name.


Report on the CSC202 test

Name Matrix Number Total Marks Grade
Ali 1225 90 A
Dave 1227 87 A
Chen 1300 69 B
Is it just me, or does that example sort by matrix number/ marks instead of name?
Last edited by iamthwee; Jul 27th, 2008 at 6:02 pm.
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Jul 29th, 2008
0

Re: can anyone help me with this C program?

Click to Expand / Collapse  Quote originally posted by Tigran ...
I'll try to use them [code tags] from now on, didn't know it before, so thanks again
Really? At the top if this forum are the following posts:
  • Please use BB Code and Inlinecode tags
  • Read This Before Posting
Additionally info is listed in The Forum Rules you were asked to read multiple times when you registered. And if that's not enough, they are also explained on the background of the box you posted all your messages in. What else could we have done to help you?
Moderator
Reputation Points: 3278
Solved Threads: 892
Posting Sage
WaltP is offline Offline
7,718 posts
since May 2006
Jul 30th, 2008
-2

Re: can anyone help me with this C program?

I do believe post #3 was counter productive, at least, for the OP.
Last edited by iamthwee; Jul 30th, 2008 at 3:24 am.
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Jul 30th, 2008
1

Re: can anyone help me with this C program?

Click to Expand / Collapse  Quote originally posted by WaltP ...
Really? At the top if this forum are the following posts:
  • Please use BB Code and Inlinecode tags
  • Read This Before Posting
Additionally info is listed in The Forum Rules you were asked to read multiple times when you registered. And if that's not enough, they are also explained on the background of the box you posted all your messages in. What else could we have done to help you?
What should i now do? go kill myself?
Just kiddin'
Is it such a big deal? the code wasn't even big atall.
Just a reminder is enough. To start using it.
Reputation Points: 24
Solved Threads: 8
Junior Poster in Training
Tigran is offline Offline
90 posts
since Jun 2008

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: Help in Parking time
Next Thread in C Forum Timeline: Binary addition in C





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


Follow us on Twitter


© 2011 DaniWeb® LLC