Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(20 Pts) Choose the function below which accepts an int value, adds 9 to it and multiplies it by a random number between 1 and

(20 Pts) Choose the function below which accepts an int value, adds 9 to it and multiplies it by a random number between 1 and 10. If the result is even, the function should return false, if odd, return true.

bool odd (int n) {

int n; cout << "Enter an integer" << endl; cin >> n; bool oddNo = true; n+=9; n *= rand()%10 + 1; if(n%2==0) oddNo = false; return oddNo; }

bool odd (int n) { bool oddNo = true; n+=9; n *= rand()%10 + 1; if(n%2==0) oddNo = true; return oddNo; }
bool odd (int n) { bool oddNo = true; n+=9; n *= rand()%10 + 1; if(n%2==0) oddNo = false; return oddNo; }
bool odd (int n) { bool oddNo = true; n+=9; n *= rand()%10 + 1; if(n/2=0) oddNo = false; return oddNo; }

Flag this Question

Question 615 pts

(15 Pts) Choose the function below that best performs the following task: ask a user to enter a series of integers. The user should enter -99 to signal the end of the series. After exiting the loop, the function should return the highest of the numbers entered.

int findHighest () { int high =-99, num; cout << Enter a series of integers -99 to stop << endl; do { do { cin << num; } while(num != -99 && num < 0) if(num > high) high = num;

} while(num = -99); return high; }

void findHighest () { int high =-99, num; cout << Enter a series of integers -99 to stop << endl; do { do { cin << num; } while(num != -99 && num < 0) if(num > high) high = num;

} while(num != -99); return high; }

int findHighest () { int high =-99, num; cout << Enter a series of integers -99 to stop << endl; do { do { cin << num; } while(num != -99 && num < 0) if(num > high) num =high;

} while(num != -99); return high; }

int findHighest () { int high =-99, num; cout << Enter a series of integers -99 to stop << endl; do { do { cin << num; } while(num != -99 && num < 0) if(num > high) high = num;

} while(num != -99); return high; }

Flag this Question

Question 715 pts

Which function below best performs the following task: Write a function which accepts two int values. The function should return 0 if they are the same, 1 if the first is larger and 2 if the second is larger.

int compare(int one, int two)

{

int status = 2;

if(one = two)

status = 0;

else if (one > two)

status = 1;

return status;

}

int compare(int one, int two)

{

status = 2;

if(one == two)

status = 0;

else if (one > two)

status = 1;

return status;

}

int status = 2;

if(one == two)

status = 0;

else if (one > two)

status = 1;

return status;

int compare(int one, int two)

{

int status = 2;

if(one == two)

status = 0;

else if (one > two)

status = 1;

return status;

}

Flag this Question

Question 815 pts

(15 Pts) Choose the best answer below for a function which accepts any character and two integers, row and column then displays the indicated number of rows of that character, each row containing the indicated number of columns of that character. For example, the call: printChar(#, 5, 12); // 5 rows, 12 columns would display: ############ ############ ############ ############ ############

void printChar(char ch, int rows, int columns)

{

for(int row=0;row

{

for (int column=0;column

{

cout << ch << endl;

}

}

}

void printChar(char ch, int rows, int columns)

{

for(int row=0;row<5;row++)

{

for (int column=0;column<5;column++)

{

cout << #;

}

cout << endl;

}

}

char printChar(char ch, int rows, int columns)

{

for(int row=0;row

{

for (int column=0;column

{

return ch;

}

}

}

void printChar(char ch, int rows, int columns)

{

for(int row=0;row

{

for (int column=0;column

{

cout << ch;

}

cout << endl;

}

}

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

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

When do you use office circulars? Section B

Answered: 1 week ago