读入文件出错怎么回事?新
Debug Assertion Failed!Program:C:\xexam\3522999999000001\参考答案\Debug\prog1.exe
file:fscanf.c
Line:54
expression:stream!=NULL
For information on how your program can cause an assertion failure,see the Visual C++ documentation on asserts.
编译没有错误 调试和运行全出错并且不止这一套代码出错
我装的的考试系统能不能是我的系统的事啊?或者我的考试系统的事但是别的机器上面正常?请问会不会是我VC的事呢??
下面是我的全部代码:
#include <stdio.h>
#define MAX 200
int a[MAX], b[MAX], cnt = 0 ;
void writeDat() ;
void jsVal()
{
int qw, bw, sw, gw, i, ab, cd, j ;
for(i = 0 ; i < MAX ; i++) {
qw = a[i] / 1000 ;
gw = a[i] % 10 ;
bw = (a[i] - qw * 1000) / 100 ;
sw = (a[i] - qw * 1000 - bw * 100) / 10 ;
ab = qw * 10 + sw ;
cd = gw * 10 + bw ;
if(qw && gw && (ab>cd) && (ab % 2 == 0 && ab % 5 == 0) && (cd % 2)) b[cnt++] = a[i] ;
}
for(i = 0 ; i < cnt - 1 ; i++)
for(j = i + 1 ; j < cnt ; j++)
if(b[i] < b[j]) {
ab = b[j] ;
b[j] = b[i] ;
b[i] = ab ;
}
}
void readDat()
{
int i ;
FILE *fp ;
fp = fopen("C:\\xexam\\99000001\\in.dat", "r") ;
for(i = 0 ; i < MAX ; i++) fscanf(fp, "%d", &a[i]) ;
fclose(fp) ;
}
void main()
{
int i ;
readDat() ;
jsVal() ;
printf("满足条件的数=%d\n", cnt) ;
for(i = 0 ; i < cnt ; i++) printf("%d ", b[i]) ;
printf("\n") ;
writeDat() ;
}
void writeDat()
{
FILE *fp ;
int i ;
fp = fopen("C:\\xexam\\99000001\\out.dat", "w") ;
fprintf(fp, "%d\n", cnt) ;
for(i = 0 ; i < cnt ; i++) fprintf(fp, "%d\n", b[i]) ;
fclose(fp) ;
}
搜索更多相关的解决方案:
文件
----------------解决方案--------------------------------------------------------
Loaded 'ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\shimeng.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\user32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\gdi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\imm32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\advapi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\secur32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\lpk.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\usp10.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msvcrt.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\UXTHEME.DLL', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msctf.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\version.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\apphelp.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\MSCTFIME.IME', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ole32.dll', no matching symbolic information found.
The thread 0x984 has exited with code 3 (0x3).
The program 'C:\xexam\3522999999000001\参考答案\Debug\prog1.exe' has exited with code 3 (0x3).
----------------解决方案--------------------------------------------------------