1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
int i;
char c1[10], c2[10], c3[10], c4[10], c5[10], c6[10], c7[10],c8[10], c9[10]; // should these be different?
char *numbers = "numbers.txt";
ifstream file(numbers);
if (!file)
{
cout << "There was a problem opening file "
<< numbers
<< " for reading."
<< endl;
return 0;
}
cout << "Opened " << numbers << " for reading." << endl;
file.getline(c1, 10); // footnote 1
file.getline(c3, 10); // footnote 2
file.getline(c4, 10);
file.getline(c5, 10);
file.getline(c6, 10);
file.getline(c7, 10);
file.getline(c8, 10);
file.getline(c9, 10);
return 0;
}
|