Question: In c++ Write a program that generates a web page that contains a list of 100 random RGB color values. The program should write something
In c++
Write a program that generates a web page that contains a list of 100 random RGB color values. The program should write something like the following into cout.
- 324AF3
- 6A3125
... 98 additional list items here ...
Organize your code using functions.
The following shows how to save the output of your program to a file named colors.html. After doing this, open the file in a web browser to see the result.
./a.out > colors.html
this is a code that generates 100 color values randomly not sure how to combine
#include
int main() { //seeds time to default srand(time(0)); // create array char symbols[16]= {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; //double for loop for (int i = 0; i < 100; i++) { string color = ""; int index; for (int j = 0; j<6; j++) { index = rand() % 16; color += symbols[index]; } cout << color << endl; } return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
