This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
user:psechris:portfolio:cprogproject3 [2013/02/20 15:25] – [Execution] psechris | user:psechris:portfolio:cprogproject3 [2013/03/05 05:43] (current) – psechris | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ======Project: | ||
+ | A project for C/C++ by Paul Sechrist during the Spring 2013. | ||
+ | |||
+ | =====Objectives===== | ||
+ | 1. C program must return the sum of two integer arguments | ||
+ | |||
+ | =====Prerequisites===== | ||
+ | In order to successfully accomplish/ | ||
+ | |||
+ | * command line interpreters | ||
+ | * execution environments | ||
+ | * arguments & parameters | ||
+ | * data types & memory | ||
+ | * operations & functions | ||
+ | * pointers | ||
+ | * arrays | ||
+ | |||
+ | =====Background===== | ||
+ | An adder project similar to the major in class project from CSCS 1240 Problem Solving. However now the programming is in C/C++ rather than VBS. | ||
+ | |||
+ | |||
+ | =====Code===== | ||
+ | |||
+ | <code c 1> | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | |||
+ | int main() | ||
+ | { | ||
+ | unsigned char b; | ||
+ | unsigned char a; | ||
+ | |||
+ | |||
+ | |||
+ | fprintf(stdout, | ||
+ | fscanf(stdin, | ||
+ | fprintf(stdout, | ||
+ | fscanf(stdin, | ||
+ | unsigned char ans = (a+b); | ||
+ | fprintf(stdout, | ||
+ | |||
+ | return 0; | ||
+ | } | ||
+ | </ | ||
+ | =====Execution===== | ||
+ | |||
+ | <cli> | ||
+ | E: | ||
+ | Enter first integer: | ||
+ | 1 | ||
+ | Enter second integer: | ||
+ | 1 | ||
+ | Your answer for 1 plus 1 is: 2 | ||
+ | E: | ||
+ | </ |