# Thread: C++ Help!!!

1. ## C++ Help!!!

This is an assignment I have an I cannot figure it out for the life of me.

Task 1: Write the following function to sort three numbers in increasing order

Void sort(int num1, int num2, int num3)

The main program should read the three numbers from key board and invoke the above function

Task 2: Write a function that computes the sum of the digits in an integer (integers with 3 digits only. Ex: 234, 345 etc)
Hint: Use the % operator to extract digits and the / operator to remove the extracted digit. For instance, to extract 4 from, use 234 % 10 (=4). To remove 4 from 234, use 234/10 (=23).

Any help would be greatly appreciated.

2. Task 1: ...
Void sort(int num1, int num2, int num3)
I don't believe this would work. May-be you meant:
Code:
`void sort(int& num1, int& num2, int& num3);`
Task 2: Write a function that computes the sum of the digits in an integer (integers with 3 digits only. Ex: 234, 345 etc)
Use the &#37; operator to extract digits and the / operator to remove the extracted digit. For instance, to extract 4 from, use 234 % 10 (=4). To remove 4 from 234, use 234/10 (=23).

What part of this you don't understand?

Popular pages Recent additions