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, 22.06.2019 21:30
How do you take a green screen out of the video while editing?
Answers: 2
question
Computers and Technology, 23.06.2019 00:10
My has been slow anyone elseโ€™s ?
Answers: 1
question
Computers and Technology, 23.06.2019 20:30
Column a of irmaโ€™s spreadsheet contains titles for each row, but her document is too big and will be printed three pages across. she wants to be sure that every page will be understood. what can irma do to with this problem?
Answers: 3
question
Computers and Technology, 23.06.2019 21:40
language consists of basic components, and they are called a. 3; mental images, concepts, and speech b. 2; language acquisition and linguistic relativity c. 3; heuristics, algorithms, and analogies d. 4; phonemes, morphemes, syntax, and semantics e. 2; words and grammar
Answers: 3
You know the right answer?
Modify the following Program. Convert the following program as per comments // program colors
...
Questions
question
Social Studies, 27.08.2019 17:30
question
Mathematics, 27.08.2019 17:30
question
Chemistry, 27.08.2019 17:30
Questions on the website: 13722363