If I am way off feel free to say to start over.
#include <string>
#include <fstream>
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
using std::ofstream;
using std::ifstream;
using std::ios;
using std::string;
int main()
{
string name = "";
int num = 0;
int updatedNum = 0;
int x = 0;
int heading = 0;
int columnHeaders = 0;
int underLines = 0;
ifstream inFile;
inFile.open("numbers.txt", ios::in);
//determine whether the file was opened
if (inFile.is_open())
{
//read a record
getline(inFile, name);
inFile >> num;
while (inFile.eof())
{
//display the record
cout << name << " " << endl;
//read another record
getline(inFile, name);
inFile >> num;
}
inFile.close();
}
else
cout << "The file could not be opened." << endl;
//create file object and open the file
ofstream outFile;
outFile.open("updatedNumbers.txt", ios::out);
//write the updated numbers to the file
outFile << heading << endl << endl;
outFile << columnHeaders << endl;
outFile << underLines << endl;
for(int x = 0; x++;);
outFile << num[x] << endl;
//end for
outFile << endl;
//close the file
outFile.close();
return 0;
can not get it to compile to try it out the error I get is :error C2109: subscript requires array or pointer type the error is on line 63 but I can not figure out how to fix this.

New Topic/Question
Reply



MultiQuote







|