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

I HAVE THE PROGRAM BELOW. IT\'S SUPPOSED TO READ and PRINT FIRST 5 ROW OF DATA F

ID: 3712190 • Letter: I

Question

I HAVE THE PROGRAM BELOW. IT'S SUPPOSED TO READ and PRINT FIRST 5 ROW OF DATA FROM "FDNY_Monthly_Response_Times.csv"; however, I'm getting the output message "Could not read file." I've checked the csv files name, and there is no mistake with that. I've put the main.cpp and and FDNY_Monthly_Response_Times.csv in the same directory, but I'm still getting the same output message "Could not read file."

What am I doing wrong? What is missing? How can I fix this with keeping the structure of my program?

Please in Clear Steps. Thank you.

main.cpp No Selection #include 2 #include

Explanation / Answer

Following are the possible problem occurring in your code:

1) At line 55 instead of writing if(inFile) try writing if(myFile.isOpen()). Also as c++ is case sensitive try making infile->inFIle.

2) At line 34 the if statement is running in all case which means at line 73 the function is returning false.

if(!0) means if(1) hence it will never run the else loop.

3) Try printing the data in any of the lines between 63-67 to see whether the file is in fact opened or not. This will help you troubleshoot your program.