The user enters 5 numbers, the program creates a file and saves them to it, then re-opens it and displays the numbers, and adds them together and displays that to. How do you do that? Am I even close?
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
ifstream inputFile;
ofstream outputFile;
int num;
int total = 0;
//Create a file
outputFile.open("Lab10.txt");
cout << "Enter a number (1 of 5): ";
cin >> num;
outputFile << num << endl;
cout << "Enter a number (2 of 5): ";
cin >> num;
outputFile << num << endl;
cout << "Enter a number (3 of 5): ";
cin >> num;
outputFile << num << endl;
cout << "Enter a number (4 of 5): ";
cin >> num;
outputFile << num << endl;
cout << "Enter a number (5 of 5): ";
cin >> num;
outputFile << num << endl;
inputFile.open("Lab 10.txt");
//First Number
inputFile >> num;
cout << num << endl;
total = num + total;
//Second Number
inputFile >> num;
cout << num << endl;
total = num + total;
//Third Number
inputFile >> num;
cout << num << endl;
total = num + total;
//Fouth Number
inputFile >> num;
cout << num << endl;
total = num + total;
//Fifth Numer
inputFile >> num;
cout << num << endl;
total = num + total;
That looks pretty good, although you will probably want to close the file before you change input/output. You also have two return 0;s, which although isn't a problem, looks strange.