I am trying to finish my program where I have to print the two merging files in Alphabetical order by Last Name along with the score. NO ARRAY!! Here's what I have so far..
#include <iostream>
using namespace std;
#include <fstream>
#include <cstdlib>
#include <string>
struct person
{
string first, last;
int score;
};
int main()
{
ifstream data1, data2;
data1.open("data1.txt");
if(!data1)
{
cerr << "Error: data1 could not be opened" << endl;
exit(1);
}
data2.open("data2.txt"); // opens the file
if(!data2) // file couldn't be opened
{
cerr << "Error: data2 could not be opened" << endl;
exit(2);
}