I compiled my program only to see that I had to recreate my variables... And when I do they don't have the information... They aren't to seperate functions so... I don't know what's wrong... Can someone help me? I'm using Borland C++.
Printable View
I compiled my program only to see that I had to recreate my variables... And when I do they don't have the information... They aren't to seperate functions so... I don't know what's wrong... Can someone help me? I'm using Borland C++.
It could be caused by all the gotos you have. Try to structure your program with while/for loops instead. Gotos are not wrong, but ugly.
And you should try to have a hiearchy system in your code, like this:
instead of this:Code:int main()
{
int A=3;
if(A==3)
{
printf("Hello");
}
return 0;
}
it makes it easier to read.Code:int main()
{
int A=3;
{
printf("Hello");
}
return 0;
}
Ok, here's the updated code:
Error: rpgbasse.cpp(193,12):Undefined symbol 'hp'
Error: rpgbasse.cpp(193,16):Undefined symbol 'lvl'
Error: rpgbasse.cpp(193,19):Undefined symbol 'at'
Error: rpgbasse.cpp(193,22):Undefined symbol 'gp'
Error: rpgbasse.cpp(193,26):Undefined symbol 'nme'
You declare these variables in a sub-function, and therefore you cannot access them from main. The easiest solution would be to make them global. Declare them outside main, like this:
...and that should solve your problem!Code:int hp, mp,....
int Load()
{
...
}
int main()
{
...
}
You should use a struct instead, and then have the function
so you can make one in main and then pass it to Load, avoiding global variablesCode:int Load(const Struct_Name &t)
{
//...
}
I don't know much about classes... could you apply it, in some source code?