平方根和数组?
unser 2003-04-09 03:35:40 //求该数的平方和平方根
#include <stdio.h>
#include <math.h>
void main()
{
int a;
int b;
printf("Enter the number:\n");
scanf("%d",&a);
printf("The square of the number: %d\n",a*a);
b=(int)sqrt(a);
printf("The square root of the number: %d\n",b);
}
//如何使该数值的平方根输出为"有小数点的数"(如:3.221)
当我们要输入一条信息的时间,如果用数组定义的话,用printf语句显示的内容也只是空格之前的字符。
比如我输入为“this is my home!”,那么只显示"this".
这个问题应该怎么解决?