CS3 Homework 2-Split List Balance Solved

35.00 $

Category:

Description

Rate this product

 

215 = 32,768 and 3+2+7+6+8 = 26

Write a program product-digit-sum.cpp that computes ab = n and then the sum of the digits in n. Whatever progress you have made in implementing this program will be discussed at the next synchronous class meeting.

You should not use the math module. Your program should have a function pow(a, b) that implements the computation for ab manually. Although the user may enter negative numbers, this should be treated as invalid / unsupported inputs. So, pow(a, b) takes positive integers only.

Sample Output:

user@machine:solution$ ./pds
a: 2
b: 15
2^15 = 32768
Sum Of Digits: 26

Submission: Your program will be submitted using canvas and git + github.

1) You should create a private github.com repository (repo) with your code in it. You may need to create a github user account and a github repository. To achieve this. The name you choose for the repo and your username are arbitrary but I suggest “HW2” as the repo name.

2) Your repository on github.com should be private and you should add my account as a collaborator by going to “settings” → “manage access” → “invite collaborator” and entering my username: fmresearchnovak

3) On canvas you should upload a link to this github repository

https://github.com/fmresearchnovak/HW2.git

I will grade the final commit made before the due-date. This means that you can actually submit on canvas at any time before the deadline, and still make changes (new commits) to the code.

 

  • CS3-HW2-Split-List-Balance-main-2rqwna.zip