This shows you the differences between two versions of the page.
user:psechris:portfolio:cprogproject10 [2013/02/22 21:33] – created psechris | user:psechris:portfolio:cprogproject10 [2013/03/05 04:31] (current) – [Code] psechris | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ======Project: | ||
+ | A project for CSCS 1320 by Paul Sechrist during the Spring 2013. | ||
+ | |||
+ | =====Objectives===== | ||
+ | C program must: | ||
+ | * Ask the user to enter a number | ||
+ | * place entered value into a variable | ||
+ | * display a message accordingly | ||
+ | * if value < 50 "You suck" | ||
+ | * if value == 50 "Way to ruin the joke." | ||
+ | * if value > 50 "Well, someone' | ||
+ | | ||
+ | =====Code===== | ||
+ | <code c 1> | ||
+ | # | ||
+ | |||
+ | int main() | ||
+ | { | ||
+ | int a; | ||
+ | fprintf(stdout, | ||
+ | fscanf(stdin," | ||
+ | if (a<50) | ||
+ | { | ||
+ | fprintf(stdout, | ||
+ | } | ||
+ | |||
+ | else if (a==50) | ||
+ | { | ||
+ | fprintf(stdout, | ||
+ | } | ||
+ | |||
+ | else if (a>50) | ||
+ | { | ||
+ | fprintf(stdout, | ||
+ | } | ||
+ | return(0); | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | =====Execution===== | ||
+ | <cli> | ||
+ | lab46: | ||
+ | Please enter a number: | ||
+ | 1 | ||
+ | YOU SUCK! | ||
+ | lab46: | ||
+ | Please enter a number: | ||
+ | 50 | ||
+ | you ruined the joke.... | ||
+ | lab46: | ||
+ | Please enter a number: | ||
+ | 100 | ||
+ | Wellllll, someone' | ||
+ | lab46: | ||
+ | </ | ||
+ | |||
+ | =====Reflection===== | ||
+ | Fairly easy, good way to learn how to use if statements. | ||
+ | =====References===== | ||
+ | Kellen kinda helped.... a bit. |