Blog Closed

This blog has moved to Github. This page will not be updated and is not open for comments. Please go to the new site for updated content.

Thursday, February 21, 2008

Programming Fantasticism

A few code snippets from the lab reports this week that I would like to share. I won't even comment on them right now.

The first one:

if(key == '1')
value = 1;
else if(key == '2')
value = 2;
else if(key == '3')
value = 3;
else if(key == '4')
value = 4;
else if(key == '5')
value = 5;
else if(key == '6')
value = 6;
else if(key == '7')
value = 7;
else if(key == '8')
value = 8;
else if(key == '9')
value = 9;

The second one:

if(input == 'C') goto getnextvalue
else goto exit;
exit:
return 0;

And finally:

char inputs[7] = "+123456";
...
printf("%c%c%c%c%c%c%c\n", inputs[0], inputs[1],
inputs[2], inputs[3], inputs[4], inputs[5], inputs[6]);

Should give you a bit of an idea what I'm working with here.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.