|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include <stdio.h>
void main()
{
int r = 3;
float = ares;
ares = r*r;
printf("%d\n", (int)ares); //这里不加(int)为什么会得到0,强制转换了才能输出9.
}
还有一个问题就是结构体定义4个变量,为什么手动输入只能输出2个???
#include <stdio.h>
static struct student
{
int num;
char *name,sex;
float socre;
};
void main()
{
struct student boy1,boy2;
printf("Please input num: ");
scanf("%d",&boy1.num);
printf("Please input name: ");
scanf("%c\n",&boy1.name);
printf("Please input sex: ");
scanf("%c\n",&boy1.sex);
printf("Please input socre: ");
scanf("%lf\n",&boy1.socre);
printf("%d,%c,%c,%lf\n", boy1.num, boy1.name, boy1.sex, boy1.socre);
}
//请详细解答谢谢。。
|
|