Questions: 11 448

Answers by our Experts: 10 707

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Using the code stub below, output all combinations of character variables a, b, and c, in the order shown below. If a = 'x', b = 'y', and c = 'z', then the output is: xyz xzy yxz yzx zxy zyx

Your code will be tested in three different programs, with a, b, c assigned with 'x', 'y', 'z', then with '#', '$', '%', then with '1', '2', '3’.


#include

using namespace std;


int main() {

char a;

char b;

char c;


cin >> a;

cin >> b;

cin >> c;


/* Your solution goes here */


cout << endl;


return 0;

}


1) which of the following is not a control structure used in C++?

A) Iteration

B) Decision

C) Sequence

D) Transformation


2) which of the following causes a syntax error?

A) Missing semicolon in statement in main().

B) A problem in calling function.

C) adding parameters to int main() function

D) storing a string in an integer


3) cin is

A) variable

B) built-in function

C) user-defined function

D) constructor


4) which of the following statement is correct above the array?

A) A pointer must always be initialized within functions.

B) A pointer must always be initialized outside all functions

C) A pointer must always be initialized .

D) none of the above


5) which of the following best describes polymorphism?

A) single value

B) several values

C) single form

D) multiple forms


Type two statements that use rand() to print 2 random integers between (and including) 100 and 149. End with a newline. Ex:

101

133

Note: For this activity, using one statement may yield different output (due to the compiler calling rand() in a different order). Use two statements for this activity. Also, srand() has already been called; do not call srand() again.

#include <cstdlib> // Enables use of rand()

#include <ctime>  // Enables use of time()

using namespace std;

int main() {

  int seedVal;

  cin >> seedVal;

  srand(seedVal);

  /* Your solution goes here */

  return 0;

}

Using the code stub below, type a statement using srand() to seed random number generation using variable seedVal. Then type two statements using rand() to print two random integers between (and including) 0 and 9. End with a newline. Ex:

 5

 7

Note: For this activity, using one statement may yield different output (due to the compiler calling rand() in a different order). Use two statements for this activity. Also, after calling srand() once, do not call srand() again.

#include <iostream>

#include <cstdlib> // Enables use of rand()

using namespace std;

int main() {

  int seedVal;

  cin >> seedVal;

  /* Your solution goes here */

  return 0;

}

Using the code stub below, write a program that reads a person's first and last names, separated by a space. Then the program outputs last name, comma, first name. End with newline.

Example output if the input is: Akua Mperey

Mperey, Akua

#include <iostream>

#include <string>

using namespace std;


int main() {

  string firstName;

  string lastName;

  /* Your solution goes here */

  return 0;

}

Using the code stub below, output all combinations of character variables a, b, and c, in the order shown below. If a = 'x', b = 'y', and c = 'z', then the output is:

xyz xzy yxz yzx zxy zyx

Your code will be tested in three different programs, with a, b, c assigned with 'x', 'y', 'z', then with '#', '$', '%', then with '1', '2', '3’.

#include <iostream>

using namespace std;

int main() {

  char a;

  char b;

  char c;

  cin >> a;

  cin >> b;

  cin >> c;

  /* Your solution goes here */

  cout << endl;

  return 0;

}

Print a message telling a user to press the letterToQuit key numPresses times to quit. End with newline.

•Ex: If letterToQuit = 'q' and numPresses = 2, print:

Press the q key 2 times to quit.

#include <iostream>

using namespace std;

int main() {

  char letterToQuit;

  int numPresses;

  cin >> letterToQuit;

  cin >> numPresses;

  /* Your solution goes here */

  return 0;

}

road accident is the number one killer in USA far exceeding that of HIV aids and COVID-19 put together. Most of the roads accidents are known to have been caused by driver negligence. Max of AiTSystem a software company advised that a system should be put in place to track the number of offenses committed by drivers. The system should be able to count the number of offenses committed by
each driver and make the following recommendations.

a. If a minor offense is committed by a driver, a fine of GHs 50 should be charged and the driver cautioned. A second minor offense by the same driver should
attract a fine of GHs 150 and the bared from driving for two weeks.
If the same driver commits more than two minor offenses, the driver’s license
should be confiscated and directed to go for retraining as a driver.

b. However, if a major offense is committed the driver should be investigated by DVLA.

c. On a trial bases, you are to develop a system to depict “a, and b’ above and
display the results
a. Critically explain why you would consider the concept of using functions in your program again running a couple of if else statements.

b. Declare a function with three arguments all of type int. The function should return the greatest of the three arguments, however if any two or all three are the same, you function should return that value.

c. Embed you function in a complete program that requests for three variable all of type int and display the conditions explained in “b” above.

d. Critically explain the logic behind the code.
The electoral petition of 2021 was aimed at determining the winner of the 2020 election. The
rule is that the winner of an election in Ghana must obtain at least 50% +1 of the valid votes
cast.

a. Explain the concept of function in C++

b. Declare a function called Greatest, your function should have five arguments
i. The two names of the presidential candidates with the most votes
ii. Total number of votes for each of them.
iii. Total valid votes cast.

c. Your function should declare that candidate that had at least 50%+1 of the valid votes
cast as winner.

d. Explain the logic behind the code
LATEST TUTORIALS
APPROVED BY CLIENTS