首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

C语言error LNK1120 LNK2019,该如何处理

2012-10-16 
C语言error LNK1120 LNK2019#include stdio.h#include stdlib.h#include string.h#include io.h//

C语言error LNK1120 LNK2019
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <io.h>

//选择法排序
int main(){
int flag,n,i=0,j,k,t,b;
int temp[1024];
FILE *in,*out;
char inFileName[90],outFileName[90]; 

printf("please input the input file name:\n"); 
scanf("%s",&inFileName); 
printf("please input the output file name:\n"); 
scanf("%s",&outFileName); 

if((in=fopen(inFileName,"rt"))==NULL) 

printf("无法打开输入文件\n"); 
return 1; 

else {
//读入输入文件
while (!EOF);{
fscanf(in,"%d",&temp[i++]);
}
n=i;
fclose(in);
}

if((out=fopen(outFileName,"w+"))==NULL) 

printf("无法打开输出文件\n"); 
return 1; 

else{
//选择排序,从小到大排列数据
for(j=0;j<n-1;j++){
t=j;
for(k=j+1;k<n;k++)
if(temp[t]>temp[j])
t=j;
if(j!=t){
b = temp[t];
temp[t] = temp[j];
temp[j] = b;
}
}

printf("please input '0' or '1'to choose the way of sorting\n");
printf("'0'for from small to big\n");
printf("'1'for from big to small\n");
scanf("%d",&flag);
switch (flag){
case 0:
i=0;
while(i<n)fprintf(out,"%d",temp[i++]);
break;


case 1:
while(i+1)fprintf(out,"%d",temp[--i]);
break;


default: {
printf("input ERROR");
exit(1);
}
}
fclose(out); 
}
return 0; 
}

[解决办法]
用VS2008编译了一下,没有发现错误.

热点排行