Quote:
|
Originally Posted by Eugenia Gabrielov
Here it is everyone! My first code! thank you to all who contributed.
Most especially darkjedi
Code:
passesLegendOfMaxOnHeavy(person) {
if (person==Genia) {
return true;
} else {
return false;
}
}
if(passesLegendOfMaxOnHeavy(Genia)) {
awesome=1;
} else {
triesAgain=1;
}
There you have it.
|
I think you need a return type on your function, and a type for the argument. Also, since the C18 compiler doesn't support boolean data types, you'll have to define them another way:
Code:
#define true 1
#define false 0
#define Genia 461
unsigned char passesLegendOfMaxOnHeavy(int person) {
if (person==Genia) {
return true;
} else {
return false;
}
}
if(passesLegendOfMaxOnHeavy(Genia)) {
awesome=1;
} else {
triesAgain=1;
}
The #define statement for "Genia" allows you to create "friendly" names for people. For instance, you could also add:
Code:
#define dlavery 116
#define JVN 229
You wouldn't need those definitions if "person" was some sort of object defined in its own class, rather than an int, but it's been so long since I wrote classes in C, I wouldn't even know where to start. Trying to keep C/C++ and Java straight in your head is no walk in the park.
*removes nerd hat* I'm such a dork...
Nonetheless, awesome, Genia. You might just be a CS major in training, if you're willing to trade in your social life.
