终端机不显示第二个printf,直接退出
#include <math.h>#include <stdio.h>
main()
{
double x, s;
printf("input number:\n");
scanf("%lf", &x);
s = sin(x);
printf("sine of %lf is %lf\n",x,s);
}
本人入门新手,代码如上,为什么终端机只显示input number。在输入任意数字后,不显示第二个printf内容,终端机直接自己关闭呢?
加return0;也没用 这不是可以吗?
如果要暂停
system("pause");
ba21 发表于 2018-2-23 15:22
这不是可以吗?
如果要暂停
system("pause");
啊 我也system("pause");了没用,我觉得是visual studio 2017出问题了。 我也不会用。。。。
#include <math.h>
#include <stdio.h>
main()
{
double x, s;
printf("input number:\n");
scanf("%lf", &x);
s = sin(x);
printf("sine of %lf is %lf\n",x,s);
getchar();//加这个函数试试
} 没有加个等待用户输入的或是暂停的函数指令之类的,然后美丽的烟火只是一闪而过。。。 前几楼正解。。。{:10_249:} 其实不要按f5,按ctrl+f5也可以
页:
[1]