Question: when i input the new file, it doesnt name the file correctly (the first letter is missing) #include #include using namespace std; int main() {
when i input the new file, it doesnt name the file correctly (the first letter is missing)

#include#include using namespace std; int main() { ifstream infile; ofstream outfile; string filename; string name; string txt = ".txt"; char user_input; double height; double years_of_service; //prompt user for filename cout > filename; filename = filename + ".txt"; //opens file infile.open(filename); //read file getline(infile, name); infile >> height; infile >> years_of_service; //prints info with height and years of service conversion cout > user_input; if(user_input == 'c'){ return 0; }else{ cin >> filename; outfile.open(filename + ".txt"); outfile indow Help prog02 (CA Users kylea CLion Projects\prog02] - ..\main.cpp Clion - A gentX.but ACMakelists.txt sa main.cpp using namespace std; 6 int main() { ifstream infile; ofstream outfile; string filename; string name; string txt - ".txt"; char user_input; double height; double years_of_service; 1/prompt user for filename cout > filename; filename = filename + ".txt 1/opens file infile.open(filename); 1/read file getline(& infile, & name); infile >> height; Infile >> years_of_service; 1/prints info with height and years of service conversion cout > user_input, I if(user_input I. 'c'> cin >> filename; outfile.open(filename + txt, lositapp); cout
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
