Question: (Write in c++) A. Write function titles. (a) Write the title line for a function called dashLine that takes an integer parameter, then prints -
(Write in c++) A. Write function titles. (a) Write the title line for a function called dashLine that takes an integer parameter, then prints "-" the same amount of times as this integer. (b) 6 functions are called in the following main function. Write title lines for these functions. int main(){ int a = 100; string b = read(); double c = magic(a + 2.5); if ( isOk(c) ) print(b); if ( check(a + 1) == 'b' ) cout << "It's ascii value 97"; cout << firstDigit(a) << endl; //this would print out the first digit of variable a return 0; } The following may be in in groups of 2. B. Write following functions. (a) A function called largerThan9 that checks whether the integer parameter is larger than 9, return true if it is, return false otherwise. (b) A function called rollDice that returns a random dice value (1-6). (c) A function called emphasis which print a string parameter 3 times to screen.(use loop).
Extra Credit: In your main function. 1. Use function roll dice three times, to generate 3 dice values. Print each number to screen. 2. Add previous dice values together to a variable called sum. 3. Use function largerThan9, to check whether the sum is greater than 9. 4. Repeat step 1, 2, 3 until the sum is larger than 9. 5. Use function emphasis, to print out string "Yes! Finally." 3 times to screen. Example: Roll dice: 2 1 6 Roll dice: 3 3 2 Roll dice: 4 3 1 Roll dice: 1 5 6 Yes! Finally.Yes! Finally.Yes! Finally.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
