求大佬解答
c4droid吧
全部回复
仅看楼主
level 8
求大佬解答
2018年04月14日 14点04分 1
level 7
你那个大于号用的是中文输入法,改成英文输入法>再试试
2018年04月14日 19点04分 2
谢谢,手机上那个是间括号,系统默认一输,就是一对,我没反应过来,感谢!
2018年04月14日 23点04分
level 9
if(x>y)
{
z=x;
}
else
{
z=y;
}
return z;
if后要加{}
2018年04月14日 19点04分 5
谢谢,不是{}的原因,是>错了,我的是中文输入法,{}中一句复不复合无所谓
2018年04月14日 23点04分
level 8
求大佬修改下程序,使得在调用这函数是起到时间变化所类似的过程,注意a,b,c这三变量,不是输进去的,而是通过赋值得到的,结果就是timepass(1,23,45)->t[7,23,45],并且所调用的函数s(时),f(分),m(秒)改变
2018年04月15日 00点04分 6
level 8
#include<stdio.h>
int main()
{
int t[3];
int i;
int timepass(int a,int b,int c);
t[]=timepass(1,23,45);
for (i=0;i<2;i++)
printf("%d",t[i]);
return 0;
}
int timepass(int a,int b,int c)
{
int t[3];
int s=6,f=0,m=0;
if ((m+c)>=60)
{
m=m+c-60;
f++;
}
else
m=m+c;
if ((f+b)>=60)
{
f=f+b-60;
s++;
}
else
f=f+b;
if ((s+a)>=24)
s=s+a-24;
else
s=s+a;
int t[0]=s,int t[1]=f,int t[2]=m;
return (t[]);
}(内部有很多错误,求大佬们改正,或者用其他方法)
2018年04月15日 00点04分 7
level 11
声明函数为什么写在main函数里面
2018年04月15日 05点04分 8
level 11
用指针做函数参数
2018年04月15日 05点04分 9
好吧,我试试
2018年04月15日 07点04分
level 7
#include<stdio.h>
int main()
{
int* t;
int i,a,b,c;
printf("输入经过的时间:");
scanf("%d%d%d",&a,&b,&c);
int*timepass(a,b,c);
t=timepass(a,b,c);
printf("%d:%d:%d",*t,*(t+1),*(t+2));
return 0;
}
int* timepass(int a,int b,int c)
{
int t[3];
int s=6,f=0,m=0;
if ((m+c)>=60)
{
m=m+c-60;
f++;
}
else
m=m+c;
if ((f+b)>=60)
{
f=f+b-60;
s++;
}
else
f=f+b;
if ((s+a)>=24)
s=s+a-24;
else
s=s+a;
t[0]=s;t[1]=f;t[2]=m;
return (t);
}
2018年04月16日 07点04分 10
level 7
2018年04月16日 07点04分 11
level 8
[笑眼]感谢大佬
2018年04月16日 08点04分 12
1