Programming, Software and Code

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.

This entry was originally posted on Blogger and was automatically converted. There may be some broken links and other errors due to the conversion. Please let me know about any serious problems.