The document is a request for help fixing C++ code that prints the letters "CSCE" and "UNT" on an image with a white background. The code provided initializes a 3D array to store pixel colors, sets pixel colors to draw the letters, and saves the image to a file. The request is to modify the code to meet project requirements of displaying the letters centered in the top and bottom halves of a 640x320 image with 10 pixel spacing and randomly colored letters.
Application of Matrices in real life. Presentation on application of matrices
Hello My code prints but I need this exact code to print unt and hav.pdf
1. Hello My code prints but I need this exact code to print unt and have a white background in the
back as the project states the other person helped and I appriciate the help but the other person
code was not printting. please can you help me print the code out? Ill give the code for what I
need to fix. please fix on C++ thank you.
My code:
#include
#include
using namespace std;
int main() {
const int MAXR = 480, MAXC = 640;
uint8_t colors[MAXR][MAXC][3];
for(int i = 0; i< MAXR; i++) {
for(int j = 0; j < MAXC; j++) {
colors[i][j][0] = static_cast(255);
colors[i][j][1] = static_cast(255);
colors[i][j][2] = static_cast(255);
}
}
// Letter C
for(int i = 40; i <= 440; i++) {
for(int j = 10; j <= 60; j++) {
colors[i][j][0] = 0;
colors[i][j][2] = 0;
}
}
for(int i = 390; i <= 440; i++) {
for(int j = 10; j <= 210; j++) {
colors[i][j][0] = 0;
colors[i][j][2] = 0;
}
}
for(int i = 40; i <= 440; i++) {
for(int j = 160; j <= 210; j++) {
colors[i][j][0] = 0;
5. return 0;
}
The purpose of this project is to write C++ programs using arrays and vectors where functions
are used to initialize them, modify them and write them to a file. We discussed in class how to
create a ppm image using a three-dimensional array of type uint8_t. Our image displayed the
characters UNT in green color with a white background. The image size was 640320 pixels. In
this project you will create a similar image of size 640320 pixels where 640 is the width and 320
is the height in pixels. In the top half of the image you will display CSCE and in the bottom half
of the image you will display UNT. Center each text in their respective half horizontally. The
vertical spacing between characters should be 10 pixels and the vertical spacing from characters
to the top and bottom edges of the image as well as to the horizontal line in the center of the
image should be 10 pixels. The horizontal spacing between the left and right edges and the top
line of characters should be 10 pixels. The horizontal spacing between the left and right edges
and the bottom line of characters should be at least 10 pixels. The horizontal spacing between
characters should be 10 pixels. All the above specifications mean that the height of each
character would be 140 pixels. The top line of characters would be vertically centered on row 70
and the bottom line of characters would be vertically centered on row 230. You can choose the
width of each character while making sure that the horizontal spacing between characters is 10
pixels. Color each character randomly. Use the same random color for every pixel in a character.
Use a three-dimensional array for handling the top half of the image. Use a three-dimensional
vector for handling the bottom half of the image. The following function prototypes should be
used and the corresponding functions be defined and called from main. //initialize top half of the
image with a white background void initializeTopHalf(uint8_t arr[][maxr][3], const int maxc,
const int maxr); //initialize bottom half of the image with a white background vector>>
initializeBottomHalf(const int maxc, const int maxr); //Fill top half with the characters CSCE
void fillTopHalf(uint8_t arr[][maxr][3], const int maxc, const int maxr); //Fill bottom half with
the characters UNT void fillBottomHalf(vector>>& vec, const int maxc, const int maxr); //Write
top half to image file void writeTopHalf(ofstream& fout, uint8_t arr[][maxr][3], const int maxc,
const int maxr); //Fill bottom half with the characters UNT void writeBottomHalf(ofstream&
fout, vector < vector < vector < uint_8>>>& vec, const int maxc, const int maxr);