1
每次构建并运行我的项目文件时,一旦与其交互,就会崩溃。Codeblocks project.exe已停止工作C
#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'不能确保适当的类型。 – chris 2013-04-06 18:38:34
当'a'和'b'都未初始化时,为什么你有'complexnumber = a + b * j'这行?当你说“当我与它互动”时,你具体指的是哪一点?你输入什么值? – 2013-04-06 18:41:10