Ezembi
100 / 87 / 3
Регистрация: 29.05.2013
Сообщений: 227
|
07.06.2013, 11:18
|
|
Чтение:
C++ | 1
2
3
4
5
6
7
8
9
10
| struct road Road[2*ROAD_MAX];
FILE *f1;
f1 = fopen("input.txt","r");
fscanf(f1,"%d %d",&N,&M);
for(int i=0;i<M;i++)
{
if(fscanf(f1,"%d %d",&Road[i].city1,&Road[i].city2)==EOF)
break;
}
fclose(f1); |
|
Запись:
C++ | 1
2
3
4
| FILE *f2;
f2 = fopen("output.txt","w");
fprintf(f2,"State count: %d\n",stateCount);
fclose(f2); |
|
1
|