subject

Modify the following Program. Convert the following program as per comments // program colors

// -> Convert class into .h header file and .ccp implemenation file.
// Keep int main() funciton same...
#include
using namespace std;
#include
/* srand example */
#include
#include /* NULL */
#include /* srand, rand */
class colorPicker {
private:
string colorArray[7];
public:
colorPicker() {
// Defalut Consructor assign values to array

colorArray[0] ="Red";
colorArray[1] ="Green";
colorArray[2] ="Purple";
colorArray[3] ="Yellow";
colorArray[4] ="Orange";
colorArray[5] ="Indigo";
colorArray[6] ="Pink";

}
void printAllColors() {
// use for loop to print out all colors
for (int i = 0 ;i < 7; i++)
{ cout << colorArray[i] << endl;}
}

string randomColor() {
srand((unsigned)time(0));
// pick a random number between 1 and 7
int i =0;
i = rand()%7;
return colorArray[i];
}
};
int main()
{
colorPicker P;
//

P. printAllColors();

cout << "Random Color: " << P. randomColor();

system("pause");

return 0;

}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 06:30
Who can provide you with a new password when you have forgotten your old one? your provide you with a new password in case you forget your old one.
Answers: 3
question
Computers and Technology, 23.06.2019 21:10
Asample of 200 rom computer chips was selected on each of 30 consecutive days, and the number of nonconforming chips on each day was as follows: 8, 19, 27, 17, 38, 18, 4, 27, 9, 22, 30, 17, 14, 23, 15, 14, 12, 20, 13, 18, 14, 20, 9, 27, 30, 13, 10, 19, 12, 26. construct a p chart and examine it for any out-of-control points. (round your answers to four decimal places.)
Answers: 2
question
Computers and Technology, 24.06.2019 03:30
Other - a written response, no less than arial 12-point font, to the following: of the following, which would you consider is most important to customer service goals? choose one and explain why. (1) accuracy (2) punctuality and attendance (3) courtesy (4) productivity (5) organization
Answers: 1
question
Computers and Technology, 25.06.2019 01:30
If the average computer chip had 1,200 transistors per square inch in 1970, approximately how many transistors per square inch would one have in 1976? use moore's law to calculate your answer
Answers: 1
You know the right answer?
Modify the following Program. Convert the following program as per comments // program colors
...
Questions
Questions on the website: 13722367