The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 304 Weeks Ago, 2 Days Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
I need help with the rest of this code. I know strings and arrays are involved in this code. The HW6 attached explains what needs to be done. The output needs to look like the second page of the HW6. The answers and tests documents attached are used toward the output. It would be much appreciated. Thank you. Using Visual Studio 2017 or 2015. C++.
Â
Â
#include <fstream>
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
Â
void main()
{
int numstudents = 0, numcorrect, i, chart[20][5] = { 0 };
Â
ifstream finkey, finstud;
finkey.open("Answers.dat");
finstud.open("Tests.dat");
ofstream fout;
fout.open("Output.dat");
string key, id, responses;
finkey >> key;
finstud >> id >> responses;
fout << "Student-ID" << setw(50) << "Number Correct" << endl;
while (!finstud.eof())
{
numstudents++;
numcorrect = 0;
for (i = 0; i < 20; i++)
if (key[i] == responses[i])
numcorrect++;
fout << id << numcorrect << endl;
finstud >> id >> responses;
}Â Â
fout << endl;
fout << "Number of students taking exam = " << numstudents << endl;
Â
/*we have done the first 2 things asked. Next is the distribution chart
Â
/*The new thing is 2D arrays. Declare an array. to call a 2D array element, use the same notation - chart[0][0] is the first element.Â
If we didn't want to zero out the chart on the declaration statement, could we do this elsewhere in our code? How?Â
  YES!! A nested loop!! We will need the nested loops for HW6, and not just to zero out*/
Â
/*You need to tally eveything before outputting it. You can build the chart as you read it.Â
Rows= the number of the question shifted by one and Columns= the letter's place in the alphabet.Â
Somewhere in the while loop, bump the appropriate chart box. When you print out the actual chart, you can use a nested loop*/
Â
system("pause");
}CBEDBEBAECDDAEEBDEDE
430-52-6192 CBADEEAAECADBEEBAECE
112-81-5225 CBEDBEBAECDDDEEBDEDE
120-49-5322 CDEDBAABECCDAAEBADDE
456-65-3211 AACCEEDDEEAEDBADEAEA
990-45-0978 AABDEDEAEDBCEEBEACEC
324-98-5445 DDEAACEDACDEEEACEDDE
112-34-3443 CDEDBAABECCDAAEBADDE
435-56-8790 CBEDBBBAECDDAEECDEDE
452-23-5675 DEDDDDEAEEACBDEEEEEE
776-45-5454 EEEEEEEEEEEEEEEEEEEE
567-71-9909 ABCDEDEACEBBAEDDEEEA
345-54-7834 CDECDEEEDCDADEEEAADE
555-12-2341 CDEDBABAECDDAEEBDEDE
568-09-0096 CBEDBEBAECDDAEEBDEDE
664-61-0987 CDEDBAEEACDBEAEDBEDE
612-45-7687 AABCDEBBEDACBEAEBDEE
567-23-1125 DEDEEEAABBCCDDEEABED
561-43-6781 CDEDEADEDDDEDABCCEEE
498-12-4321 AABBCCDDEEAABBCCDDEE
479-01-4867 BEEEACDEAECEACEABCEE
489-90-0999 CBEEEEBAECDDAEEBDEEE
456-09-1111 CBEDBEBAECDDAEEBDADE
Â
561-66-6657 CCAADEABBEAEDCBEEABE
Â
Â
 ----------- He-----------llo----------- Si-----------r/M-----------ada-----------m ----------- ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be-----------