
Сообщение от
alsav22
А у меня работает:
C++ |
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
| #include<iostream>
#include<windows.h>
#include<conio.h>
#include<fstream>
using namespace std;
const int L=31;
struct student{
char fam[L];
char im[L];
char ot[L];
char gr[8];
int nz;
};
void inputMassStudentFile(student x[],int &n);
void outputMassStudent(student x[],int n);
void main()
{
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
student a[30];
int m;
inputMassStudentFile(a,m);
outputMassStudent(a,m);
}
void inputMassStudentFile(student x[],int &n)
{
ifstream fin;
char file[L];
fin.open("1.txt");
if(fin.fail())
{
cout<<"1.txt"<<"не открыт";
getch;
return;
}
n=0;
while (fin >> x[n].fam >> x[n].im >> x[n].ot >> x[n].gr >> x[n].nz)
{
n++;
}
fin.close();
}
void outputMassStudent(student x[],int n)
{
int i;
for(i=0;i<n;i++)
{
cout<<x[i].fam<<" "<<x[i].im<<" "<<x[i].ot<<" "<<x[i].gr<<" "<<x[i].nz<<endl;
}
getch();
} |
|
Скопировал текст, пересобрал, результат тот же...Даже не знаю