Finishing touches on little brother c++ program to read text file.?

ok it says.
Assuem that you are reading from a data file named progData11.txt which contains two lines. The first line contains the correct answers to a multiple choice test. Each answer is one of the letter A,B,C,D,E. The second line contains the answers of a test taker. Produce three lines of output. The first line is a list of correct ansers. The second is a list of the test taker’s answers. The third line is a list of + or – symbols. If a question is answered correctly, a + sign should be printed. If a question is answered incorrectly, a – sign should be printed. Also, the percentage of correct answers should be printed.

Ex.

(data file reads)

ABCDEABCDE
EDCBAEDCBA

(output)
A B C D E A B C D E
E D C B A E D C B A
- – + – - – - + – -

percentage correct = 20

[[[I really appreciate any tips, not asking for an entire program just something to get us started because I dont remember any of this stuff. Its a tough nut but if you think you can crack it have at it. thanks guys]]]

__________________________________________________________

have this so far but cant figure out how to get percentage to output
got this so far

#include
#include
#include
#include
int main()
{

std::ifstream file(“J:\\progData11.txt”);
std::vector vec;
std::string s;
while(std::getline(file,s))
vec.push_back(s);
std::cout << vec[0] << “\n” << vec[1] << “\n”;
for(int i = 0; i < vec[0].size(); ++i)

{
if(vec[0].at(i) == vec[1].at(i) && vec[0].at(i) != ‘ ‘)
std::cout << “+”;
else std::cout << “-”;

}
system(“pause”);
return 0;
}

This entry was posted in Uncategorized and tagged , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>