Here is my homework.(Write a program to read 10 name from and input file, each name has 5 grades (from another input file)
now display and print them to an output file. Send input files, source code, and output file for grading
i got a problem to read names, grades from two different input files and store them in the same file.
Think about this in logical steps. This is what your program needs to do:
Open first file.
Read in names and scores and store them in variables.
Close first file.
Open second file.
Read in names and score and store them in variables.
Close second file.
Create third file.
Write in the information you stored from the other two files.
Close third file.
What @Mats said is probably the most logical way to do things, and less chance for you to get muddled up but if you REALLY want to open 2 files at the same time then all you need to do is create 2 instances of the ifstream and use one for each file.