该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
解N元一次方程从文件读入整数 N, 然后读入N*( N+1)矩阵,得到解并输出到文件中。
int main(){
int ch;
printf("+=======================+\n");
printf("+ Gaussian Matrix Cal +\n");
printf("+=======================+\n");
printf("Choose:1.Input Matrix 2.Read Matrix From File\n");
printf("Your choice:");
scanf("%d",&ch);
if(ch!=1&&ch!=2){
printf("Enter Error!!!\n");
return 0;
}
switch(ch) {
case 1:
printf("Enter a filename to save data:");
scanf("%s",filename);
if(!InputMatrix()){
printf("Not enough memory/Input error!!!\n");
return 0;
}
if(!OuputMatrix()) return 0;
break;
case 2:
printf("Enter The Matrix File Name:");
scanf("%s",filename);
if(!(fp=fopen(filename,"rb"))){
printf("Cannot Open the data file!!!\n");
return 0;
}
if(!ReadMatrix()){
printf("Unknown File Format!!!\n");
return 0;
}
break;
default:
printf("Unexpected Error occured!!");
return 0;
}
if(!GaussCal()){
printf("Math error/Not enough Memory!\n");
return 0;
}
if(!Result()){
printf("Cannot Create Result File!!!");
return 0;
}
printf("All Done!!!\n");
if(fp) fclose(fp);
if(out) fclose(out);
if(Mat) free(Mat);
if(X) free(X);
if(buff) free(buff);
return 1;
}
怎吗解释这个程序啊
好像没有把解输出到文件中的语句啊???
帮帮忙拉!!!