`digits.cpp``seconds.cpp``primes.cpp`

- Write a
**function**called`SumDigits`that takes in an integer parameter and computes and returns the sum of its digits. If the incoming integer is negative, then disregard the negative (and still compute the sum of the digits, as a positive result).- This function should not depend on any LIMIT to the number of digits. Assume no limit to how many digits a number can have (remember the range of an int depends on the computer architecture -- it differs for different machines -- the function should work for any number of digits).

- To test this function, write a
`main()`routine that enters a loop, in which the user is prompted and allowed to enter any integer (0 to exit the loop), and the integer is sent to the function and the result printed. The user should keep being asked for inputs until they type a 0 to exit.

Please enter an integer (0 to quit):124566The sum of the digits of 124566 is 24 Please enter an integer (0 to quit):23453245The sum of the digits of 23453245 is 28 Please enter an integer (0 to quit):45454545The sum of the digits of 45454545 is 36 Please enter an integer (0 to quit):-9189845The sum of the digits of -9189845 is 44 Please enter an integer (0 to quit):0Goodbye

- Write a
**function**calledthat takes in three integer parameters (representing hours, minutes, and seconds) and returns the number of seconds since the last time the clock "struck 12" (i.e. was at 12:00:00 -- AM or PM doesn't matter since you're not tracking this).**Seconds**

- To test this function, write a
`main()`routine (in the same file) that prompts the user to enter hours, minutes, and seconds for two different clock times; then uses the Seconds function to calculate the shortest amount of time in seconds between the two times (both of which are within one 12-hour cycle of the clock); the print out the number of seconds since "striking 12" for both clocks, as well as the number of seconds between the two clock times

Input first clock time... Hours:6Minutes:45Seconds:30Input second clock time... Hours:4Minutes:50Seconds:12It's been 24330 seconds since the first clock struck 12:00 It's been 17412 seconds since the second clock struck 12:00 The two times are 6918 seconds apart.

Input first clock time... Hours:12Minutes:43Seconds:16Input second clock time... Hours:7Minutes:11Seconds:59It's been 2596 seconds since the first clock struck 12:00 It's been 25919 seconds since the second clock struck 12:00 The two times are 23323 seconds apart.

- Recall that an integer is a
*prime*number if it is divisible only by 1 and itself. Write a**function**calledthat takes in one integer parameter X and determines whether or not X is prime. The function should return a**IsPrime**`bool`value:- return
`true`if X is a prime number - return
`false`if X is not a prime number.

`%`operator is good for checking for divisibility of one integer by another)

- return
- To test this function, write a
`main()`routine that asks the user to input a positive integer N. Using your`IsPrime()`function, find and print all the prime numbers less than or equal to N, where the output has 8 numbers per line (you can use tab characters to separate numbers on a line).

Please input a positive number:500The prime numbers less than or equal to 500 are: 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 467 479 487 491 499

- No global variables, other than constants
- The required tasks
**must**be performed with the**functions**specified (not just with a single`main()`routine)- Note that each exercise requires the writing of a function, and a main routine to test that function.
- Each function should do
*exactly*the task specified in item 1 of each exercise - Item 2 of each exercise specifies what to do in
`main()`-- this will always involve CALLING the function, sometimes more than once - Note that there is NO keyboard-input/screen-output specified in the functions themselves (i.e. "return" does not mean "print")

- All input and output must be done with streams
- You may use the
`iostream`and`iomanip`libraries (the ones that have been discussed in class) - When you write source code, it should be readable and well-documented.
- Your program should only use standard ANSI header files (make sure
to
follow the directions exactly on the handout for creating Visual C++
projects, so that Windows-specific headers like stdafx.h and conio.h are
*not*placed into your file)

digits.cpp seconds.cpp primes.cpp