Перегрузим функцию OutputArray
C++ |
1
2
3
4
5
6
| void OutputArray(ofstream out)
{
for(int i=0; i<n; i++)
out << " " << array[i];
out << endl;
} |
|
Тогда
C++ |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| int main()
{
InputArray();
ofstream out("outputfile.txt");
if(!out)
{
cout<<"output file open error";
return 1;
}
OutputArray(out);
out << endl << "Kol-vo null: " << NumNull() << endl;
out << endl;
Zamena();
OutputArray(out);
cout << "see result in file outputfile.txt"<<endl;
return 0;
} |
|