c语言程序编译没问题,但是无法运行
#include<conio.h>#include<stdio.h>#include<stdlib.h>unsignedfun(unsignedw){if(w>=1000...
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
unsigned fun(unsigned w)
{
if(w>=10000)
return w%10000; /*求出n位整数w的后n-1位的数*/
if(w>=1000)
return w%1000;
if(w>=100)
return w%100;
if(w>=10)
return w%10;
}
void main()
{
FILE *wf;
unsigned x;
system("CLS");
printf("Enter a unsigned integer number: ");
scanf ("%u",&x);
printf("The original data is:%u\n",x);
if(x<10)
printf("Data error! ");
else
printf ("The result :%u\n", fun(x));
/******************************/
wf=fopen("out.dat","w");
fprintf(wf,"%u",fun(5923));
fclose(wf);
/*****************************/
} 展开
#include<stdio.h>
#include<stdlib.h>
unsigned fun(unsigned w)
{
if(w>=10000)
return w%10000; /*求出n位整数w的后n-1位的数*/
if(w>=1000)
return w%1000;
if(w>=100)
return w%100;
if(w>=10)
return w%10;
}
void main()
{
FILE *wf;
unsigned x;
system("CLS");
printf("Enter a unsigned integer number: ");
scanf ("%u",&x);
printf("The original data is:%u\n",x);
if(x<10)
printf("Data error! ");
else
printf ("The result :%u\n", fun(x));
/******************************/
wf=fopen("out.dat","w");
fprintf(wf,"%u",fun(5923));
fclose(wf);
/*****************************/
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |