:?: I am attempting to write a C++ program that has the results of a T/F test. It takes the information from a data file and then it compares the students answers to the correct answers. I have two problems. First the data file has the first 8 characters as the Student ID(Letters and Numbers), then it has a blank space followed by the student answers. Can someone give me some ideas about how I would maybe use strcmp or would I use a method of comparing Arrays?
The output would be the student ID followed by the student answers and then a Grade.
I just need help getting started in the right direction. So far my ideas have been bad...
klmbrt
0
Newbie Poster
Recommended Answers
Jump to PostBy sounds of things you've sort of headed in the right direction with strcmp, and your ideas may not be as bad as you think. Give us an example of what you've come up with so far and take if from there.
Remember to enclose code using code tags.
Jump to PostI gather it will be safe to assume students results will always start at position 10. This is just one example of how it can be done.
char *Answer = &str [9]; int Pos = 0, Correct = 0; str [8] = 0; // Terminator at end …
Jump to PostI'm not sure I understand the line:
single Ratio = (single (Answer) / single (Pos)) * 100The method here is referred to as typecasting. In this case if you were to divide 19 by 21 lets say and leave them as integers you would get 0. Actually as integers …
All 11 Replies
Tight_Coder_Ex
17
Posting Whiz in Training
klmbrt
0
Newbie Poster
klmbrt
0
Newbie Poster
klmbrt
0
Newbie Poster
Tight_Coder_Ex
17
Posting Whiz in Training
klmbrt
0
Newbie Poster
Tight_Coder_Ex
17
Posting Whiz in Training
klmbrt
0
Newbie Poster
Tight_Coder_Ex
17
Posting Whiz in Training
Dave Sinkula
2,398
long time no c
Team Colleague
Tight_Coder_Ex
17
Posting Whiz in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.