c++ 问题在于2
来源:百度知道 编辑:UC知道 时间:2024/07/03 00:11:09
/*------------------------------------------------
【程序设计】
--------------------------------------------------
功能:求一个大于10的n位整数的后n-1位的数,并作为函
数值返回。
------------------------------------------------*/
#include "stdio.h"
#include"conio.h"
int fun(int w)
{
/**********Program**********/
/********** End **********/
}
main()
{
int m;
printf("Enter m: ");
scanf("%d", &m);
printf("\nThe result is %d\n", fun(m));
yzj();
}
yzj()
{
FILE *IN,*OUT;
int c ;
int t;
int o;
IN=fopen("in.dat","r");
if(IN==NULL)
{
printf("Read File Error");
}
OUT=fopen("out.dat","w");
if(OUT==NULL)
{
printf("Write File Error");
【程序设计】
--------------------------------------------------
功能:求一个大于10的n位整数的后n-1位的数,并作为函
数值返回。
------------------------------------------------*/
#include "stdio.h"
#include"conio.h"
int fun(int w)
{
/**********Program**********/
/********** End **********/
}
main()
{
int m;
printf("Enter m: ");
scanf("%d", &m);
printf("\nThe result is %d\n", fun(m));
yzj();
}
yzj()
{
FILE *IN,*OUT;
int c ;
int t;
int o;
IN=fopen("in.dat","r");
if(IN==NULL)
{
printf("Read File Error");
}
OUT=fopen("out.dat","w");
if(OUT==NULL)
{
printf("Write File Error");
int fun(int w)
{
/**********Program**********/
char v[100];
sprintf(v, "%d", w);
sscanf(v+1, "%d", &w);
return w;
/********** End **********/
}
int fun(int w)
{
int s=0,t=1;
while(w>10)
{
s+=t*(w%10);
w/=10;
t*=10;
}
return s;
}
#include "stdio.h"
#include "conio.h"
int fun(int w)
{
/**********Program**********/
int a[6];
int i;
int tmp;
int sum = 0;
if (w < 10)
{
printf("Input number is not bigger than 10! Please check.\n");
return -1;
}
else
{
for (i = 0; i < 6; i++)
{
if (w / 10 != 0)
{
a[i] = w % 10;
w = w / 10;
}
else
{
a[i] = w % 10;
break;
}
}
tmp = i;
for