SophiaPretty

(4)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 116 Weeks Ago, 2 Days Ago
Questions Answered: 15833
Tutorials Posted: 15841

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 23 Oct 2017 My Price 9.00

Ask for input for numerous non-negative integers.

Directions

Points

The file must be called unit2Prog.cpp

 

Program Definition

1 Create program definition for sumDigits Function. Function will receive and return an integer.

 

Main Method

1 Ask for input for numerous non-negative integers.

2 Using pass-by-reference, pass integer received into recursive function called sumDigits.

3 Receive result back from sumDigits and output result to screen.

4 Include: system("PAUSE");after your output to pause the screen.

See example below.

 

sumDigits Function (Receives integer)

1 Recursivelycall sumDigits adding up the integers received.

2 Return result to main method for output.

3 If a single digit is received, just return it to the main method.

 

Example output of your program

Run 1:

Enter a nonnegative integer: 23

The sum of the digits of 23 is 5

Run 2:

Enter a nonnegative integer: 1234

The sum of the digits of 1234 is 10

Run 3:

Enter a nonnegative integer: 90513

The sum of the digits of 90513 is 18

Run 4:

Enter a nonnegative integer: 2147483647

The sum of the digits of 2147483647 is 46

Answers

(4)
Status NEW Posted 23 Oct 2017 01:10 PM My Price 9.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)