View Single Post
  #13   Spotlight this post!  
Unread 22-02-2005, 20:54
jgannon's Avatar
jgannon jgannon is offline
I ᐸ3 Robots
AKA: Joey Gannon
no team
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Pittsburgh, PA
Posts: 1,467
jgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond repute
Re: Teach Genia How to Program and Win a Prize

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.
__________________
Team 1743 - The Short Circuits
2010 Pittsburgh Excellence in Design & Team Spirit Awards
2009 Pittsburgh Regional Champions (thanks to 222 and 1218)
2007 Pittsburgh Website Award
2006 Pittsburgh Regional Champions (thanks to 395 and 1038)
2006 Pittsburgh Rookie Inspiration & Highest Rookie Seed

Team 1388 - Eagle Robotics
2005 Sacramento Engineering Inspiration
2004 Curie Division Champions (thanks to 1038 and 175)
2004 Sacramento Rookie All-Star

_
Reply With Quote