Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Here is one of my function in c++ it is not working I am tryingto read form a fi

ID: 3614412 • Letter: H

Question

Here is one of my function in c++ it is not working I am tryingto read form a file and print to the screen. The file name isdata.dat and the file contain this two line:…My instructorwant us to used array of or struct she is not to fun of stringclass.

What is my firstname:bob:10:rober:5

What is my lastname:chris:10:colbert:5

#include <fstream>

void readDisplayQuestions()

{

     ifstream inputFile;

     char myfile[80];

     char fileName[80];

    

     cout<<"Enter a file name: ";

     cin>>fileName;

     cout<<endl;

     inputFile.open(fileName);

  

     if(!inputFile)

     {

          cout<<"invalid file"<<endl;

     }

     int i = 0;

    

     for(i = 0; i<=80; i++)

     {

          

          inputFile >> myfile[i];

  

     }

     cout<< myfile;

    

     // close File

    

     inputFile.close();

}

Explanation / Answer

please rate - thanks I'm not sure what you want but this will get your code working #include #include using namespace std; void readDisplayQuestions(); int main() {      ifstream inputFile;      char myfile[80];      char fileName[80];         coutfileName;      cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote