Question: Complete the attached lab18.cpp file by implementing the functions that are called by the given main function. You are not allowed to change any


Complete the attached lab18.cpp file by implementing the functions that are called by the given main function. You are not allowed to change any code in the main function. Note: use the best function title lines. Sample Output: [[swu@venus cs111]$ ./a.out [Enter your name: Andy [Enter your age: 20 Hello Andy! 16 +93 +26 = 135 Last digit of 135 is 5 Last digit of 20 is 0 [[swu@venus cs111]$ ./a.out [Enter your name: Nina [Enter your age: -1 Hello Nina! Age can't be negative [[swu@venus cs111]$ ./a.out [Enter your name: Lisa [Enter your age: 19 Hello Lisa! 28 +43 + 86 = 157 Last digit of 157 is 7 Last digit of 19 is 9 lab 18.cpp #include #include #include using namespace std; /* Implement the functions that are called in the following main function. Note: use the best function title lines. */ int main() { } string user; int age, x, y, z; cout < < "Enter your name: cin >> user; cout < < "Enter your age: cin >> age; printHello (user); //printHello prints Hello to the input // isNegative returns true if the input is negative; otherwise, returns false if (isNegative (age)) { cout < < "Age can't be negative" < < endl; exit(0); } srand(time (0)); x = twoDigitNum(); // twoDigitNum returns a random 2-digit positive integer y twoDigitNum(); z twoDigitNum(); int sum add3(x, y, z); // add3 returns the total of 3 input numbers cout < < x
Step by Step Solution
3.38 Rating (157 Votes )
There are 3 Steps involved in it
The C program that contains all the required functions is as follows include include include using n... View full answer
Get step-by-step solutions from verified subject matter experts
