一段代码,编译正确,但是运行说ball_vx未被定义,,,求帮助!
g=1.7; //重力float ball_v=0;
float ball_vx=0;
while(1)
{
if(kbhit())
{
char input=_getch();
if (input==' ') //按空格跳跃
ball_v=-40 ;
if(input=='z')
ball_vx=-40;
if(input=='x')
ball_vx=40; //左右跳跃
}
#include <stdio.h> int main() { float g=1.7; //重力 // 没有定义数据类型 float ball_v=0; float ball_vx=0; while(1) { if(kbhit()) // kbhit()函数是什么东东? { char input=_getch(); if (input==' ') //按空格跳跃 ball_v=-40 ; if(input=='z') ball_vx=-40; if(input=='x') ball_vx=40; //左右跳跃 } } // 缺少花括号 } // 缺少花括号