SlideShare a Scribd company logo
1 of 5
Download to read offline
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;
colors[i][j][2] = 0;
}
}
// Letter S
for(int i = 40; i <= 90; i++) {
for(int j = 430; j <= 630; j++) {
colors[i][j][0] = 0;
colors[i][j][2] = 0;
}
}
for(int i = 190; i <= 240; i++) {
for(int j = 430; j <= 630; j++) {
colors[i][j][0] = 0;
colors[i][j][2] = 0;
}
}
for(int i = 290; i <= 340; i++) {
for(int j = 10; j <= 210; j++) {
colors[i][j][0] = 0;
colors[i][j][2] = 0;
}
}
for(int i = 390; i <= 440; i++) {
for(int j = 430; j <= 630; j++) {
colors[i][j][0] = 0;
colors[i][j][2] = 0;
}
}
// 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;
colors[i][j][2] = 0;
}
}
// Letter E
for(int i = 40; i <= 440; i++) {
for(int j = 505; j <= 555; j++) {
colors[i][j][0] = 0;
colors[i][j][2] = 0;
}
}
for(int i = 190; i <= 240; i++) {
for(int j = 505; j <= 555; j++) {
colors[i][j][0] = 0;
colors[i][j][2] = 0;
}
}
for(int i = 340; i <= 390; i++) {
for(int j = 505; j <= 555; j++) {
colors[i][j][0] = 0;
colors[i][j][2] = 0;
}
}
for(int i = 260; i <= 310; i++) {
for(int j = 250; j <= 300; j++) {
colors[i][j][0] = 0;
colors[i][j][2] = 0;
}
}
for(int i = 260; i <= 310; i++) {
for(int j = 350; j <= 400; j++) {
colors[i][j][0] = 0;
colors[i][j][2] = 0;
}
}
for(int i = 260; i <= 310; i++) {
for(int j = 450; j <= 500; j++) {
colors[i][j][0] = 0;
colors[i][j][2] = 0;
}
}
for(int i = 260; i <= 310; i++) {
for(int j = 550; j <= 600; j++) {
colors[i][j][0] = 0;
colors[i][j][2] = 0;
}
}
// Save the image to a file
ofstream fout("csce.ppm");
fout << "P3" << endl;
fout << MAXC << ' ' << MAXR << endl;
fout << 255 << endl;
for(int i = 0; i < MAXR; i++) {
for(int j = 0; j < MAXC; j++) {
fout << static_cast(colors[i][j][0]) << ' ' << static_cast(colors[i][j][1]) << ' ' <<
static_cast(colors[i][j][2]) << ' ';
}
fout << endl;
}
fout.close();
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);

More Related Content

Similar to Hello My code prints but I need this exact code to print unt and hav.pdf

Client Side Programming with Applet
Client Side Programming with AppletClient Side Programming with Applet
Client Side Programming with Applet
backdoor
 
Patrick Kettner - JavaScript without javascript
Patrick Kettner - JavaScript without javascriptPatrick Kettner - JavaScript without javascript
Patrick Kettner - JavaScript without javascript
OdessaJS Conf
 
C++ Course - Lesson 2
C++ Course - Lesson 2C++ Course - Lesson 2
C++ Course - Lesson 2
Mohamed Ahmed
 
Qust & ans inc
Qust & ans incQust & ans inc
Qust & ans inc
nayakq
 

Similar to Hello My code prints but I need this exact code to print unt and hav.pdf (20)

Client Side Programming with Applet
Client Side Programming with AppletClient Side Programming with Applet
Client Side Programming with Applet
 
Nonlinear 2nd order analysis of 2 d fixed support beam with plastic hinge con...
Nonlinear 2nd order analysis of 2 d fixed support beam with plastic hinge con...Nonlinear 2nd order analysis of 2 d fixed support beam with plastic hinge con...
Nonlinear 2nd order analysis of 2 d fixed support beam with plastic hinge con...
 
C- Programming Assignment 3
C- Programming Assignment 3C- Programming Assignment 3
C- Programming Assignment 3
 
Patrick Kettner - JavaScript without javascript
Patrick Kettner - JavaScript without javascriptPatrick Kettner - JavaScript without javascript
Patrick Kettner - JavaScript without javascript
 
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
 
.net progrmming part2
.net progrmming part2.net progrmming part2
.net progrmming part2
 
Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...
Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...
Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...
 
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...
 
Introduction to cpp (c++)
Introduction to cpp (c++)Introduction to cpp (c++)
Introduction to cpp (c++)
 
CE344L-200365-Lab5.pdf
CE344L-200365-Lab5.pdfCE344L-200365-Lab5.pdf
CE344L-200365-Lab5.pdf
 
Javascript Without Javascript
Javascript Without JavascriptJavascript Without Javascript
Javascript Without Javascript
 
C++ Course - Lesson 2
C++ Course - Lesson 2C++ Course - Lesson 2
C++ Course - Lesson 2
 
LDCQ paper Dec21 with answer key_62cb2996afc60f6aedeb248c1d9283e5.pdf
LDCQ paper Dec21 with answer key_62cb2996afc60f6aedeb248c1d9283e5.pdfLDCQ paper Dec21 with answer key_62cb2996afc60f6aedeb248c1d9283e5.pdf
LDCQ paper Dec21 with answer key_62cb2996afc60f6aedeb248c1d9283e5.pdf
 
Qust & ans inc
Qust & ans incQust & ans inc
Qust & ans inc
 
C++ Code as Seen by a Hypercritical Reviewer
C++ Code as Seen by a Hypercritical ReviewerC++ Code as Seen by a Hypercritical Reviewer
C++ Code as Seen by a Hypercritical Reviewer
 
Include
IncludeInclude
Include
 
Los dskn
Los dsknLos dskn
Los dskn
 
Nonlinear analysis of frame with hinge by hinge method in c programming
Nonlinear analysis of frame with hinge by hinge method in c programmingNonlinear analysis of frame with hinge by hinge method in c programming
Nonlinear analysis of frame with hinge by hinge method in c programming
 
Maker All - Executive Presentation
Maker All - Executive PresentationMaker All - Executive Presentation
Maker All - Executive Presentation
 
R Programming Intro
R Programming IntroR Programming Intro
R Programming Intro
 

More from almonardfans

1.Early versions of Supply chain included physical distribution and .pdf
1.Early versions of Supply chain included physical distribution and .pdf1.Early versions of Supply chain included physical distribution and .pdf
1.Early versions of Supply chain included physical distribution and .pdf
almonardfans
 
1. �Son precisas y veraces las afirmaciones de marketing de Smiths .pdf
1. �Son precisas y veraces las afirmaciones de marketing de Smiths .pdf1. �Son precisas y veraces las afirmaciones de marketing de Smiths .pdf
1. �Son precisas y veraces las afirmaciones de marketing de Smiths .pdf
almonardfans
 
1.. Todos los siguientes elementos han sido identificados como impor.pdf
1.. Todos los siguientes elementos han sido identificados como impor.pdf1.. Todos los siguientes elementos han sido identificados como impor.pdf
1.. Todos los siguientes elementos han sido identificados como impor.pdf
almonardfans
 
1.----A method which enables the user to specify conditions to displ.pdf
1.----A method which enables the user to specify conditions to displ.pdf1.----A method which enables the user to specify conditions to displ.pdf
1.----A method which enables the user to specify conditions to displ.pdf
almonardfans
 
1. �Cu�l es la diferencia entre una bacteria F + y una Hfr d. Las.pdf
1. �Cu�l es la diferencia entre una bacteria F + y una Hfr d. Las.pdf1. �Cu�l es la diferencia entre una bacteria F + y una Hfr d. Las.pdf
1. �Cu�l es la diferencia entre una bacteria F + y una Hfr d. Las.pdf
almonardfans
 
1. �Cu�l es la relaci�n entre Enron y SOX La quiebra y el esc�n.pdf
1. �Cu�l es la relaci�n entre Enron y SOX La quiebra y el esc�n.pdf1. �Cu�l es la relaci�n entre Enron y SOX La quiebra y el esc�n.pdf
1. �Cu�l es la relaci�n entre Enron y SOX La quiebra y el esc�n.pdf
almonardfans
 
1.) Imagina tres puntos en un mapa topogr�fico que est�n ubicados en.pdf
1.) Imagina tres puntos en un mapa topogr�fico que est�n ubicados en.pdf1.) Imagina tres puntos en un mapa topogr�fico que est�n ubicados en.pdf
1.) Imagina tres puntos en un mapa topogr�fico que est�n ubicados en.pdf
almonardfans
 
1. �Por qu� no hubo un plan de sucesi�n en Lakkard Leather Carl F.pdf
1. �Por qu� no hubo un plan de sucesi�n en Lakkard Leather Carl F.pdf1. �Por qu� no hubo un plan de sucesi�n en Lakkard Leather Carl F.pdf
1. �Por qu� no hubo un plan de sucesi�n en Lakkard Leather Carl F.pdf
almonardfans
 

More from almonardfans (20)

1.For the standard (reference) SpMV algorithm, does the communicatio.pdf
1.For the standard (reference) SpMV algorithm, does the communicatio.pdf1.For the standard (reference) SpMV algorithm, does the communicatio.pdf
1.For the standard (reference) SpMV algorithm, does the communicatio.pdf
 
1.Does ZeRO propose solution for memory- or compute-bounded problem.pdf
1.Does ZeRO propose solution for memory- or compute-bounded problem.pdf1.Does ZeRO propose solution for memory- or compute-bounded problem.pdf
1.Does ZeRO propose solution for memory- or compute-bounded problem.pdf
 
1.Early versions of Supply chain included physical distribution and .pdf
1.Early versions of Supply chain included physical distribution and .pdf1.Early versions of Supply chain included physical distribution and .pdf
1.Early versions of Supply chain included physical distribution and .pdf
 
1.A tee with 33 tips will be given, with three of them filled by�D.pdf
1.A tee with 33 tips will be given, with three of them filled by�D.pdf1.A tee with 33 tips will be given, with three of them filled by�D.pdf
1.A tee with 33 tips will be given, with three of them filled by�D.pdf
 
1.A person is said to have referent power over you to the extent tha.pdf
1.A person is said to have referent power over you to the extent tha.pdf1.A person is said to have referent power over you to the extent tha.pdf
1.A person is said to have referent power over you to the extent tha.pdf
 
1. �Son precisas y veraces las afirmaciones de marketing de Smiths .pdf
1. �Son precisas y veraces las afirmaciones de marketing de Smiths .pdf1. �Son precisas y veraces las afirmaciones de marketing de Smiths .pdf
1. �Son precisas y veraces las afirmaciones de marketing de Smiths .pdf
 
1. �Qu� ventajas y desventajas encontraron las primeras plantas que .pdf
1. �Qu� ventajas y desventajas encontraron las primeras plantas que .pdf1. �Qu� ventajas y desventajas encontraron las primeras plantas que .pdf
1. �Qu� ventajas y desventajas encontraron las primeras plantas que .pdf
 
1.2 Practice (SOA Sample Q127) A company owes 500 and 1,000 to be pa.pdf
1.2 Practice (SOA Sample Q127) A company owes 500 and 1,000 to be pa.pdf1.2 Practice (SOA Sample Q127) A company owes 500 and 1,000 to be pa.pdf
1.2 Practice (SOA Sample Q127) A company owes 500 and 1,000 to be pa.pdf
 
1. �Qu� evento convenci� a Netflix para cambiar a un servicio basado.pdf
1. �Qu� evento convenci� a Netflix para cambiar a un servicio basado.pdf1. �Qu� evento convenci� a Netflix para cambiar a un servicio basado.pdf
1. �Qu� evento convenci� a Netflix para cambiar a un servicio basado.pdf
 
1.. Todos los siguientes elementos han sido identificados como impor.pdf
1.. Todos los siguientes elementos han sido identificados como impor.pdf1.. Todos los siguientes elementos han sido identificados como impor.pdf
1.. Todos los siguientes elementos han sido identificados como impor.pdf
 
1.----A method which enables the user to specify conditions to displ.pdf
1.----A method which enables the user to specify conditions to displ.pdf1.----A method which enables the user to specify conditions to displ.pdf
1.----A method which enables the user to specify conditions to displ.pdf
 
1. �Cu�les son los seis pasos de un proceso de selecci�n de puestos .pdf
1. �Cu�les son los seis pasos de un proceso de selecci�n de puestos .pdf1. �Cu�les son los seis pasos de un proceso de selecci�n de puestos .pdf
1. �Cu�les son los seis pasos de un proceso de selecci�n de puestos .pdf
 
1.) Una mujer que tiene sangre tipo A positiva tiene una hija que es.pdf
1.) Una mujer que tiene sangre tipo A positiva tiene una hija que es.pdf1.) Una mujer que tiene sangre tipo A positiva tiene una hija que es.pdf
1.) Una mujer que tiene sangre tipo A positiva tiene una hija que es.pdf
 
1. �Cu�l es la diferencia entre una bacteria F + y una Hfr d. Las.pdf
1. �Cu�l es la diferencia entre una bacteria F + y una Hfr d. Las.pdf1. �Cu�l es la diferencia entre una bacteria F + y una Hfr d. Las.pdf
1. �Cu�l es la diferencia entre una bacteria F + y una Hfr d. Las.pdf
 
1. �Cu�les de las siguientes afirmaciones sobre los or�genes de la a.pdf
1. �Cu�les de las siguientes afirmaciones sobre los or�genes de la a.pdf1. �Cu�les de las siguientes afirmaciones sobre los or�genes de la a.pdf
1. �Cu�les de las siguientes afirmaciones sobre los or�genes de la a.pdf
 
1. �Cu�l es la relaci�n entre Enron y SOX La quiebra y el esc�n.pdf
1. �Cu�l es la relaci�n entre Enron y SOX La quiebra y el esc�n.pdf1. �Cu�l es la relaci�n entre Enron y SOX La quiebra y el esc�n.pdf
1. �Cu�l es la relaci�n entre Enron y SOX La quiebra y el esc�n.pdf
 
1.) Imagina tres puntos en un mapa topogr�fico que est�n ubicados en.pdf
1.) Imagina tres puntos en un mapa topogr�fico que est�n ubicados en.pdf1.) Imagina tres puntos en un mapa topogr�fico que est�n ubicados en.pdf
1.) Imagina tres puntos en un mapa topogr�fico que est�n ubicados en.pdf
 
1. �Qu� es la dominancia apical 2. �Cu�l es el papel de la auxina.pdf
1. �Qu� es la dominancia apical 2. �Cu�l es el papel de la auxina.pdf1. �Qu� es la dominancia apical 2. �Cu�l es el papel de la auxina.pdf
1. �Qu� es la dominancia apical 2. �Cu�l es el papel de la auxina.pdf
 
1. �Por qu� no hubo un plan de sucesi�n en Lakkard Leather Carl F.pdf
1. �Por qu� no hubo un plan de sucesi�n en Lakkard Leather Carl F.pdf1. �Por qu� no hubo un plan de sucesi�n en Lakkard Leather Carl F.pdf
1. �Por qu� no hubo un plan de sucesi�n en Lakkard Leather Carl F.pdf
 
1. �Por qu� la nube es importante para ciudades como Dubuque mientra.pdf
1. �Por qu� la nube es importante para ciudades como Dubuque mientra.pdf1. �Por qu� la nube es importante para ciudades como Dubuque mientra.pdf
1. �Por qu� la nube es importante para ciudades como Dubuque mientra.pdf
 

Recently uploaded

Neurulation and the formation of the neural tube
Neurulation and the formation of the neural tubeNeurulation and the formation of the neural tube
Neurulation and the formation of the neural tube
SaadHumayun7
 
The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTelling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
 
Neurulation and the formation of the neural tube
Neurulation and the formation of the neural tubeNeurulation and the formation of the neural tube
Neurulation and the formation of the neural tube
 
Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
 
The Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryThe Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. Henry
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
 
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
Operations Management - Book1.p  - Dr. Abdulfatah A. SalemOperations Management - Book1.p  - Dr. Abdulfatah A. Salem
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Morse OER Some Benefits and Challenges.pptx
Morse OER Some Benefits and Challenges.pptxMorse OER Some Benefits and Challenges.pptx
Morse OER Some Benefits and Challenges.pptx
 
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
 
The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptx
 
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptBasic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
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;
  • 2. colors[i][j][2] = 0; } } // Letter S for(int i = 40; i <= 90; i++) { for(int j = 430; j <= 630; j++) { colors[i][j][0] = 0; colors[i][j][2] = 0; } } for(int i = 190; i <= 240; i++) { for(int j = 430; j <= 630; j++) { colors[i][j][0] = 0; colors[i][j][2] = 0; } } for(int i = 290; i <= 340; i++) { for(int j = 10; j <= 210; j++) { colors[i][j][0] = 0; colors[i][j][2] = 0; } } for(int i = 390; i <= 440; i++) { for(int j = 430; j <= 630; j++) { colors[i][j][0] = 0; colors[i][j][2] = 0; } } // 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; } }
  • 3. 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; colors[i][j][2] = 0; } } // Letter E for(int i = 40; i <= 440; i++) { for(int j = 505; j <= 555; j++) { colors[i][j][0] = 0; colors[i][j][2] = 0; } } for(int i = 190; i <= 240; i++) { for(int j = 505; j <= 555; j++) { colors[i][j][0] = 0; colors[i][j][2] = 0; } } for(int i = 340; i <= 390; i++) { for(int j = 505; j <= 555; j++) { colors[i][j][0] = 0; colors[i][j][2] = 0; } } for(int i = 260; i <= 310; i++) { for(int j = 250; j <= 300; j++) { colors[i][j][0] = 0; colors[i][j][2] = 0;
  • 4. } } for(int i = 260; i <= 310; i++) { for(int j = 350; j <= 400; j++) { colors[i][j][0] = 0; colors[i][j][2] = 0; } } for(int i = 260; i <= 310; i++) { for(int j = 450; j <= 500; j++) { colors[i][j][0] = 0; colors[i][j][2] = 0; } } for(int i = 260; i <= 310; i++) { for(int j = 550; j <= 600; j++) { colors[i][j][0] = 0; colors[i][j][2] = 0; } } // Save the image to a file ofstream fout("csce.ppm"); fout << "P3" << endl; fout << MAXC << ' ' << MAXR << endl; fout << 255 << endl; for(int i = 0; i < MAXR; i++) { for(int j = 0; j < MAXC; j++) { fout << static_cast(colors[i][j][0]) << ' ' << static_cast(colors[i][j][1]) << ' ' << static_cast(colors[i][j][2]) << ' '; } fout << endl; } fout.close();
  • 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);