Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I want to know how to ask the user to input a files name because when I run this code I get the wrong file
I want to know how to ask the user to input a files name because when I run this code I get the wrong file out put. I am trying to open up a file and find out the total number of hours worked. udexiostream> #include using namespace std; Bint main() t main() ifstream in; 40 in.open("myloghours.txt"); 08 42 if (in.failo) 43 cout> date >> hours) t 56 57 : 59 60 61 62 string mon date. substr(0, 3); int ind -1; for (int = e; in; i++) {1 if (mon-months[1]) { : ind - i; :break; if (ind -1) months [n] = mon; tot hours[n] -; ind = n; : nt+ : n++i tot hours[ind] + hours; net hours +. hours; if (ind 1) months[n] mon; tot-hours[n] = 0; ind = n; tot-hours[ind] hours; += net_hours hours; cout
I want to know how to ask the user to input a files name because when I run this code I get the wrong file out put. I am trying to open up a file and find out the total number of hours worked.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started