Alright so I've been holding off on asking for help because I like figuring stuff out on my own, but this I just can't get working. I'm in a CIS 143 class which is Introduction to Programming using C++. We've been assigned a lab with little to no detail on how to do the things listed. I'll post what the lab says now:
The purpose of this lab is to practice the file input and output concepts. For this lab you may assume that the input files exist and contain appropriate data inside of them.
Four separate text files* which contain the following lines, different for each file.
(*: This isn't on the lab, but don't worry about what the name, age, id, and major are. those can be random and I can just change them what they need to be)
Name
Age
Student ID Number
Major
Your program should ask the user which of the four input files they would like to open, and then read the contents from the file. Once the contents have been read in, it should output to both the screen and a file named "output.txt" the four values were read in, arranged as follows:
"Hello <name>! You are a <age> years old <major> student, and your ID number is <ID number>"
Now I am by no means saying "Do it for me". I just need to know how to have a user type file1, file2, file3, or file4, and then have the program open that file, then have the output.txt file arrange the wording into the sentence above. We were never shown this and I can not find it anywhere online. I would just like help with knowing where to start this.
This is what I have so far and I don't think it is anywhere near correct:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;