Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A. Write function titles. (a) Write the title line for a function called dashLine that takes an integer parameter, then prints - the same amount

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

More Books

Students also viewed these Databases questions

Question

How satisfied are you with this attitude?

Answered: 1 week ago