关于C语言的一道题原题:Write a program that requests a type double number and prints the value of the number cubed.Use a function of your own design to cube the value and print it.The main() program should pass the entered value to this fu

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/07 09:17:17

关于C语言的一道题原题:Write a program that requests a type double number and prints the value of the number cubed.Use a function of your own design to cube the value and print it.The main() program should pass the entered value to this fu
关于C语言的一道题
原题:Write a program that requests a type double number and prints the value of the number cubed.Use a function of your own design to cube the value and print it.The main() program should pass the entered value to this funtion.
我这样写的:
#include
double cube(double num);
int main(void)
{
double number;
printf("Please enter a type double number.\n");
scanf("%f",&number);
printf("The cube of %f is %f.\n",number,cube(number));
return 0;
}
double cube(double num)
{
return (num * num * num);
}
结果怎么输入结果都是The cube of 0.000000 is 0.000000.
然后把所有的double全都改成float以后就正常运行了

关于C语言的一道题原题:Write a program that requests a type double number and prints the value of the number cubed.Use a function of your own design to cube the value and print it.The main() program should pass the entered value to this fu

 #include<stdio.h>
double cube(double num);
int main(void){ 
 double number;  
 printf("Please enter a type double number.\n"); 
 scanf("%lf", &number); //float is %f,and the double is %lf

 printf("The cube of %lf is %lf.\n", number, cube(number)); 
//float is %f,and the double is %lf

return 0;
}
double cube(double num){
 
 return (num * num * num);
}

一道简单的 C语言题目 小弟在线等Write a C program that produces the following outputCounting down54321Liftoff! 一道关于C语言函数的问题. 一道关于C语言函数的问题. 关于C语言的一道题原题:Write a program that requests a type double number and prints the value of the number cubed.Use a function of your own design to cube the value and print it.The main() program should pass the entered value to this fu 关于C语言的一道填空题,有三个空, 关于英语一道题.They enjoy the story ( )by a man.A:wrote B:written C:was written D:write 这里为什么选B不选其他的? 关于C语言的, 关于c语言的, 求 一道计算机C语言程序题的写法write a program to print a triangle using asterisks,where the triangle has at least a height of three characters. C语言的一道选择题 C语言的一道题 一道关于stop用法的题Miss Wang told us to stop ( ) to her.A.to write and listenB.writing and listening C.to write and listeningD.writing and to listen并解释其其原因和句子的意思. 关于C语言的一道题目 内部函数 外部函数下列叙述中正确的是().A:C语言编译时不检查语法B:C语言的子程序有过程和函数两种C:C语言的函数可以嵌套定义D:C语言所有函数都是外部函数答案为 rob sth from sb有没有这个词组的再问一道问题:Have you got a pen()?A.to write with B.to write C.you'll write D.will you write 关于C语言的一个简单的问题 .if(a 一道关于isprime函数的C语言题目判断a是不是素数.isprime(int a){int i;for(i=2;i 关于C语言的三道题 关于一道c语言的数学题求1+22+333+4444+55555求高手给出代码