February 26, 2007

Had a crazy week at school. Projects, term papers, midterms... After all that, come up with the following code:

being_a_programmer.cpp

#include "all the crazy stuffs"

using namespace std;

class Programmer

{

private:

energy;

knowledge;

satisfaction;

public:

Programmer() {energy = :-) ;}

~Programmer() {energy = :-( ;}

get_energy() {return energy;}

read_code(source code) {energy--;}

google(internet, books) {knowledge++;}

write_code();

debug(failed code);

relax() {energy++;}

increase_satisfaction() {satisfaction++;}

};

void main()

{

unsigned char *new_project;

new_project = (unsigned char *)calloc (??????, sizeof(unsigned char));

Programmer newguy;

int hours = 0;

while (project_not_done)

{

newguy.read_code();

newguy.google();

newguy.write_code();

newguy.debug();

if (get_energy() == VERY_LOW)

newguy.relax();

hours++;

}

newguy.increase_satisfaction();

cout << "Hours Used: " << hours;

}

Run the code, hopefully it works without ending up in an infinate loop. Otherwise, you are screwed. @_@


The University of Southern California does not screen or control the content on this website and thus does not guarantee the accuracy, integrity, or quality of such content. All content on this website is provided by and is the sole responsibility of the person from which such content originated, and such content does not necessarily reflect the opinions of the University administration or the Board of Trustees