Answered step by step
Verified Expert Solution
Link Copied!

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. image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions