954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

can anyone help me with this C program?

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

dapcigar
Newbie Poster
6 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
 

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

We help - we do not *do* the homework for you.

Adak
Nearly a Posting Virtuoso
1,479 posts since Jun 2008
Reputation Points: 425
Solved Threads: 185
 

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:
#include
#include
using namespace std;

int main(){
// all you have to do is this part
return 0;
}

Tigran
Junior Poster in Training
92 posts since Jun 2008
Reputation Points: 24
Solved Threads: 8
 

>i'll give you a start:
That's not a C program.
Learn how to properly use C programming tags .

Aia
Nearly a Posting Maven
2,392 posts since Dec 2006
Reputation Points: 2,224
Solved Threads: 218
 

Thanks

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

-Tigran

Tigran
Junior Poster in Training
92 posts since Jun 2008
Reputation Points: 24
Solved Threads: 8
 

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

ssharish2005
Posting Whiz in Training
253 posts since Dec 2006
Reputation Points: 73
Solved Threads: 20
 

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?

iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
 
I'll try to use them [code tags] from now on, didn't know it before, so thanks again :P


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?

WaltP
Posting Sage w/ dash of thyme
Moderator
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
 

I do believe post #3 was counter productive, at least, for the OP.

iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
 
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.

Tigran
Junior Poster in Training
92 posts since Jun 2008
Reputation Points: 24
Solved Threads: 8
 
Is it such a big deal?


Yes. If it wasn't a big deal, why would we mention it in so many places?

If you can't follow simple instructions, you will never be a good programmer -- nor a good anything else.

WaltP
Posting Sage w/ dash of thyme
Moderator
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
 

Well, don't want to get too much off-topic though, but first off, i thought the instructions were general forum instructions with things like don't go offtopic etc.
second, i've seen dozens of non-tagged codes, and never did so many mods etc respond to them.
an third, if you expect every single member that makes a post to make a perfect post, then you won't get many posts, really.
I hope we won't get this topic further off-topic.

Tigran
Junior Poster in Training
92 posts since Jun 2008
Reputation Points: 24
Solved Threads: 8
 

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:

dont i know how to start a program ? Im just asked u to do the program completely.Dont think and talk like a genius.If u know the answer then give a thread otherwise plzzzzz

stechrist
Newbie Poster
2 posts since Jul 2009
Reputation Points: 8
Solved Threads: 0
 

Write a C program to store students records in a file

mcamaher
Newbie Poster
1 post since Jul 2010
Reputation Points: 10
Solved Threads: 0
 

@mcamaher:

This thread is over a year old, and your request is likely to simply be buried in all the replies to the original poster.

May I strongly suggest you start a NEW thread, and add in two things:

1) Your effort to make the program, so far

and

2) Your specific problems that are stopping you, atm.

Just posting up for help, and showing no work, gets very little traction in this forum (or most forums for programming).

They don't want to just do your work, for you.

And welcome to the forum! :)

Adak
Nearly a Posting Virtuoso
1,479 posts since Jun 2008
Reputation Points: 425
Solved Threads: 185
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You