【发布时间】:2013-04-06 18:36:19
【问题描述】:
每次我构建和运行我的项目文件时,一旦我与之交互,它就会崩溃。
#include <stdio.h>
int main()
{
float complexnumber, a, b, r, j, theta;
j = -1;
complexnumber = a+b*j;
printf ("Please enter intput A and B in the form of a+bj\n");
printf ("Input A:");
scanf ("%f" , a);
printf ("Input B:");
scanf ("%f" , b);
theta = atan (a/b);
printf ("Theta=\n" , theta);
r = sqrt (pow(a, 2) + pow(b , 2));
printf ("R=\n" , r);
return 0;
}
非常感谢任何帮助
【问题讨论】:
-
很遗憾
scanf无法确保正确的类型。 -
当
a和b都未初始化时,为什么会有complexnumber = a + b * j行?当您说“当我与它互动时”时,您具体指的是哪一点?你输入的是什么值?
标签: c exe codeblocks