最赞回答 / 列奥纳多1201946
把arr数组第一个元素赋值给max设下标为index如果后面的元素大于max,那么元素赋值给max 记录这个元素下标将value值赋值给arr【i】//综上max为数组中最大值,value替换了数组最大值
2020-02-16
#include <stdio.h>
int main()
{
double numone = 2.5; //定义浮点型变量num并赋值为2.5
int numtwo=(int)numone;
printf("num的整数部分是%d\n", numtwo);
return 0;
}
int main()
{
double numone = 2.5; //定义浮点型变量num并赋值为2.5
int numtwo=(int)numone;
printf("num的整数部分是%d\n", numtwo);
return 0;
}
2020-02-16
#include <stdio.h>
#define a 97
int main()
{
char c = 'a';
int n ; //将c赋值给n
float f ; //将c赋值给f
double d ; //将c赋值给d
n=c;
f=n;
d=n;
printf("%d\n",n);
printf("%f\n",f);
printf("%lf\n",d);
return 0;
}
#define a 97
int main()
{
char c = 'a';
int n ; //将c赋值给n
float f ; //将c赋值给f
double d ; //将c赋值给d
n=c;
f=n;
d=n;
printf("%d\n",n);
printf("%f\n",f);
printf("%lf\n",d);
return 0;
}
2020-02-16
最赞回答 / 猴子七号
刚刚试了一次,应该是你输入法的英文打成全角字符了(就是类似把中文逗号当成英文逗号一样)建议以后不要看输入法打字,用系统默认英文输入键盘。将下列代码替换原来代码就可以了,普通来看确实很难看出差别。<...code...>
2020-02-15
两个思路:
要么:在printLine()前加个extern,在test.c 的say()前加个static
要么:把hello.c的#include “test.c”删掉
因为当运行#include “test.c”时相当于把test.c的函数导入到hello.c,需要把hello.c中的say()从外部函数改为内部函数,否则printLine就不知道是要调用导入到hello.c里的say()还是原本在test.c里的say()。就是产生了两个say(),需要把其中一个say()屏蔽掉。
要么:在printLine()前加个extern,在test.c 的say()前加个static
要么:把hello.c的#include “test.c”删掉
因为当运行#include “test.c”时相当于把test.c的函数导入到hello.c,需要把hello.c中的say()从外部函数改为内部函数,否则printLine就不知道是要调用导入到hello.c里的say()还是原本在test.c里的say()。就是产生了两个say(),需要把其中一个say()屏蔽掉。
2020-02-15