A project for C/C++ by Paul Sechrist during the Spring 2013.
1. C program must return the sum of two integer arguments
In order to successfully accomplish/perform this project, the listed resources/experiences need to be consulted/achieved:
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.
#include <stdio.h> #include <stdlib.h> int main() { unsigned char b; unsigned char a; fprintf(stdout, "Enter first integer: \n"); fscanf(stdin, "%hhu", &a); fprintf(stdout, "Enter second integer: \n"); fscanf(stdin, "%hhu", &b); unsigned char ans = (a+b); fprintf(stdout, "Your answer for %hhu plus %hhu is: %hhu", a, b, ans); return 0; }
E:\CCC\CSCS1320\Joe>week2project Enter first integer: 1 Enter second integer: 1 Your answer for 1 plus 1 is: 2 E:\CCC\CSCS1320\Joe>