Starting from:
$29.99

$23.99

Homework 1 Solution

Your work shall be placed in a directory structure, <username/hw/01/. This directory shall be compressed into a Zip archive file named <username.zip.  The archive should contain exactly two files:  main.cc and  makefile.   The  result of calling  the make application should  be an executable named  01hw. The  first thing my scripts will do is delete any file not called makefile or main.cc.

 

I want an  application which  takes positive or negative integers and  returns the sum  of each  place  in the number,  such that 345 results in 12 and -99 results in -18.

 

The application should perform as follows:

 

• The program  is called and runs with no prompt for input.

 

• The program  reads exactly one signed integer from standard input.

 

• The program  displays  the sum of each digit of the number  as a signed integer.



There  is an unlinked  object file1 attached to the assignment.  It may be used to create an executable on any of the Linux  servers  to which I have  made  mention.  This  is a solution to the problem.   Your  application should perform no worse than this solution.

 

Late  assignments  will lose 25% per  day  late,  with  no assignment  begin  accepted  after  4 days  (100% re- duction in points).

 

More products