SlideShare a Scribd company logo
1 of 5
Download to read offline
May I please get help on this project in C++ I need to use the code displayed bottom of the
screen. Ive been trying to code it but it's been tough. we need to use prototype function and call
them up on the top of the main then call them inside. please help me out with thi so I can study.
Thank you.
project:
C++ code given in class:
#include
#include
using namespace std;
//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>>& vec, const int maxc, const int
maxr);
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);
}
}
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;
}
}
//Horizontal part of T
for(int i = 40; i <= 90; i++) {
for(int j = 430; j <= 630; j++) {
colors[i][j][0] = 0;
colors[i][j][2] = 0;
}
}
//Vertical part of T
for(int i = 40; i <= 440; i++) {
for(int j = 505; j <= 555; j++) {
colors[i][j][0] = 0;
colors[i][j][2] = 0;
}
}
//Right vertical leg of N
for(int i = 40; i <= 440; i++) {
for(int j = 370; j <= 420; j++) {
colors[i][j][0] = 0;
colors[i][j][2] = 0;
}
}
//Left vertical leg of N
for(int i = 40; i <= 440; i++) {
for(int j = 220; j <= 270; j++) {
colors[i][j][0] = 0;
colors[i][j][2] = 0;
}
}
//Diagonal part of N
for(int i = 40; i <= 440; i++) {
int jm = (i-40)/2+220;
int jb = max(220, jm-25);
int je = min(420, jm+25);
for(int j = jb; j <= je; j++) {
colors[i][j][0] = 0;
colors[i][j][2] = 0;
}
}
ofstream fout("unt.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;
}
//initialize top half of the image with a white background
void initializeTopHalf(uint8_t arr[][maxr][3], const int maxc, const int maxr)
{
// insert code
}
//initialize bottom half of the image with a white background
vector>> initializeBottomHalf(const int maxc, const int maxr)
{
// insert code
}
//Fill top half with the characters CSCE
void fillTopHalf(uint8_t arr[][maxr][3], const int maxc, const int maxr)
{
// insert code
}
//Fill bottom half with the characters UNT
void fillBottomHalf(vector>>& vec, const int maxc, const int maxr)
{
//insert code
}
//Write top half to image file
void writeTopHalf(ofstream& fout, uint8_t arr[][maxr][3], const int maxc, const int maxr)
{
// insert code
}
//Fill bottom half with the characters UNT
void writeBottomHalf(ofstream& fout, vector>>& vec, const int maxc, const int
maxr)
{
// insert code
}
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 May I please get help on this project in C++ I need to use the code .pdf

#include iostream#includectimeusing namespace std;void.docx
#include iostream#includectimeusing namespace std;void.docx#include iostream#includectimeusing namespace std;void.docx
#include iostream#includectimeusing namespace std;void.docx
mayank272369
 
1sequences and sampling. Suppose we went to sample the x-axis from X.pdf
1sequences and sampling. Suppose we went to sample the x-axis from X.pdf1sequences and sampling. Suppose we went to sample the x-axis from X.pdf
1sequences and sampling. Suppose we went to sample the x-axis from X.pdf
rushabhshah600
 
So I am writing a CS code for a project and I keep getting cannot .pdf
So I am writing a CS code for a project and I keep getting cannot .pdfSo I am writing a CS code for a project and I keep getting cannot .pdf
So I am writing a CS code for a project and I keep getting cannot .pdf
ezonesolutions
 
write the code for Part 1 ContextFree Grammars Create con.pdf
write the code for Part 1  ContextFree Grammars Create con.pdfwrite the code for Part 1  ContextFree Grammars Create con.pdf
write the code for Part 1 ContextFree Grammars Create con.pdf
aaryanentp
 

Similar to May I please get help on this project in C++ I need to use the code .pdf (20)

PYTHON - EXTRA Chapter GUI - MAULIK BORSANIYA
PYTHON - EXTRA Chapter GUI - MAULIK BORSANIYAPYTHON - EXTRA Chapter GUI - MAULIK BORSANIYA
PYTHON - EXTRA Chapter GUI - MAULIK BORSANIYA
 
Tkinter_GUI_Programming_in_Python.pdf
Tkinter_GUI_Programming_in_Python.pdfTkinter_GUI_Programming_in_Python.pdf
Tkinter_GUI_Programming_in_Python.pdf
 
Ch 4
Ch 4Ch 4
Ch 4
 
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_...
 
Nonlinear analysis of braced frame with hinge by hinge method in c programming
Nonlinear analysis of braced frame with hinge by hinge method in c programmingNonlinear analysis of braced frame with hinge by hinge method in c programming
Nonlinear analysis of braced frame with hinge by hinge method in c programming
 
C++ Programming Homework Help
C++ Programming Homework HelpC++ Programming Homework Help
C++ Programming Homework Help
 
The code in image3.cpp has the error as shown above, could you help .pdf
The code in image3.cpp has the error as shown above, could you help .pdfThe code in image3.cpp has the error as shown above, could you help .pdf
The code in image3.cpp has the error as shown above, could you help .pdf
 
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...
 
#include iostream#includectimeusing namespace std;void.docx
#include iostream#includectimeusing namespace std;void.docx#include iostream#includectimeusing namespace std;void.docx
#include iostream#includectimeusing namespace std;void.docx
 
Arrays
ArraysArrays
Arrays
 
1sequences and sampling. Suppose we went to sample the x-axis from X.pdf
1sequences and sampling. Suppose we went to sample the x-axis from X.pdf1sequences and sampling. Suppose we went to sample the x-axis from X.pdf
1sequences and sampling. Suppose we went to sample the x-axis from X.pdf
 
Unit2 input output
Unit2 input outputUnit2 input output
Unit2 input output
 
2014 computer science_question_paper
2014 computer science_question_paper2014 computer science_question_paper
2014 computer science_question_paper
 
Constants and Unformatted Input Output Functions.pptx
Constants and Unformatted Input Output Functions.pptxConstants and Unformatted Input Output Functions.pptx
Constants and Unformatted Input Output Functions.pptx
 
So I am writing a CS code for a project and I keep getting cannot .pdf
So I am writing a CS code for a project and I keep getting cannot .pdfSo I am writing a CS code for a project and I keep getting cannot .pdf
So I am writing a CS code for a project and I keep getting cannot .pdf
 
write the code for Part 1 ContextFree Grammars Create con.pdf
write the code for Part 1  ContextFree Grammars Create con.pdfwrite the code for Part 1  ContextFree Grammars Create con.pdf
write the code for Part 1 ContextFree Grammars Create con.pdf
 
Lab 13
Lab 13Lab 13
Lab 13
 
IAT334-Lab02-ArraysPImage.pptx
IAT334-Lab02-ArraysPImage.pptxIAT334-Lab02-ArraysPImage.pptx
IAT334-Lab02-ArraysPImage.pptx
 
C cheat sheet for varsity (extreme edition)
C cheat sheet for varsity (extreme edition)C cheat sheet for varsity (extreme edition)
C cheat sheet for varsity (extreme edition)
 
Chapter1.pptx
Chapter1.pptxChapter1.pptx
Chapter1.pptx
 

More from saxenaavnish1

Mini Case identificaci�n de los clientes adecuados para el ka de Fo.pdf
Mini Case identificaci�n de los clientes adecuados para el ka de Fo.pdfMini Case identificaci�n de los clientes adecuados para el ka de Fo.pdf
Mini Case identificaci�n de los clientes adecuados para el ka de Fo.pdf
saxenaavnish1
 
me quedan 35 munites por favor ayudenme Art�culo 1 En el caso .pdf
me quedan 35 munites por favor ayudenme Art�culo 1 En el caso .pdfme quedan 35 munites por favor ayudenme Art�culo 1 En el caso .pdf
me quedan 35 munites por favor ayudenme Art�culo 1 En el caso .pdf
saxenaavnish1
 
MCQ Select the correct answer.1. What does SQL stand fora.pdf
MCQ  Select the correct answer.1. What does SQL stand fora.pdfMCQ  Select the correct answer.1. What does SQL stand fora.pdf
MCQ Select the correct answer.1. What does SQL stand fora.pdf
saxenaavnish1
 
media luna pura Sarah Ryan, vicepresidenta de marketing de Portlan.pdf
media luna pura Sarah Ryan, vicepresidenta de marketing de Portlan.pdfmedia luna pura Sarah Ryan, vicepresidenta de marketing de Portlan.pdf
media luna pura Sarah Ryan, vicepresidenta de marketing de Portlan.pdf
saxenaavnish1
 
my code doesnt work can you help me please the whole idea of is it i.pdf
my code doesnt work can you help me please the whole idea of is it i.pdfmy code doesnt work can you help me please the whole idea of is it i.pdf
my code doesnt work can you help me please the whole idea of is it i.pdf
saxenaavnish1
 
MTCR es una empresa l�der en el desarrollo y fabricaci�n de una ampl.pdf
MTCR es una empresa l�der en el desarrollo y fabricaci�n de una ampl.pdfMTCR es una empresa l�der en el desarrollo y fabricaci�n de una ampl.pdf
MTCR es una empresa l�der en el desarrollo y fabricaci�n de una ampl.pdf
saxenaavnish1
 

More from saxenaavnish1 (20)

Mire el documental Am�rica se convierte en una potencia mundial, lea.pdf
Mire el documental Am�rica se convierte en una potencia mundial, lea.pdfMire el documental Am�rica se convierte en una potencia mundial, lea.pdf
Mire el documental Am�rica se convierte en una potencia mundial, lea.pdf
 
Mini Case identificaci�n de los clientes adecuados para el ka de Fo.pdf
Mini Case identificaci�n de los clientes adecuados para el ka de Fo.pdfMini Case identificaci�n de los clientes adecuados para el ka de Fo.pdf
Mini Case identificaci�n de los clientes adecuados para el ka de Fo.pdf
 
Millie Larsen es una mujer de 84 a�os que vive sola en una casa pequ.pdf
Millie Larsen es una mujer de 84 a�os que vive sola en una casa pequ.pdfMillie Larsen es una mujer de 84 a�os que vive sola en una casa pequ.pdf
Millie Larsen es una mujer de 84 a�os que vive sola en una casa pequ.pdf
 
Miles, a 20 year old male, is seeking counseling because his paterna.pdf
Miles, a 20 year old male, is seeking counseling because his paterna.pdfMiles, a 20 year old male, is seeking counseling because his paterna.pdf
Miles, a 20 year old male, is seeking counseling because his paterna.pdf
 
Mike s 3, p 2Leo s 2 , p 2Don s 1 , p 2April s 3 , p 1.pdf
Mike  s 3, p 2Leo  s 2 , p 2Don s 1 , p 2April  s 3 , p 1.pdfMike  s 3, p 2Leo  s 2 , p 2Don s 1 , p 2April  s 3 , p 1.pdf
Mike s 3, p 2Leo s 2 , p 2Don s 1 , p 2April s 3 , p 1.pdf
 
Miguel is the managing general partner of MAR and owns a 40 interes.pdf
Miguel is the managing general partner of MAR and owns a 40 interes.pdfMiguel is the managing general partner of MAR and owns a 40 interes.pdf
Miguel is the managing general partner of MAR and owns a 40 interes.pdf
 
Michael Porter de Harvard ha propuesto la cadena de valor como una h.pdf
Michael Porter de Harvard ha propuesto la cadena de valor como una h.pdfMichael Porter de Harvard ha propuesto la cadena de valor como una h.pdf
Michael Porter de Harvard ha propuesto la cadena de valor como una h.pdf
 
Microbiology Describe the relationship between DNA and RNA con.pdf
Microbiology Describe the relationship between DNA and RNA con.pdfMicrobiology Describe the relationship between DNA and RNA con.pdf
Microbiology Describe the relationship between DNA and RNA con.pdf
 
Michael leases a Lucerne farm to Boaz for a term of three years. Aft.pdf
Michael leases a Lucerne farm to Boaz for a term of three years. Aft.pdfMichael leases a Lucerne farm to Boaz for a term of three years. Aft.pdf
Michael leases a Lucerne farm to Boaz for a term of three years. Aft.pdf
 
me quedan 35 munites por favor ayudenme Art�culo 1 En el caso .pdf
me quedan 35 munites por favor ayudenme Art�culo 1 En el caso .pdfme quedan 35 munites por favor ayudenme Art�culo 1 En el caso .pdf
me quedan 35 munites por favor ayudenme Art�culo 1 En el caso .pdf
 
Mendel logr� descubrir las leyes b�sicas de la herencia, mientras qu.pdf
Mendel logr� descubrir las leyes b�sicas de la herencia, mientras qu.pdfMendel logr� descubrir las leyes b�sicas de la herencia, mientras qu.pdf
Mendel logr� descubrir las leyes b�sicas de la herencia, mientras qu.pdf
 
MCQ Select the correct answer.1. What does SQL stand fora.pdf
MCQ  Select the correct answer.1. What does SQL stand fora.pdfMCQ  Select the correct answer.1. What does SQL stand fora.pdf
MCQ Select the correct answer.1. What does SQL stand fora.pdf
 
MCQ Pls Help ACC495 Corporate Governance and Risk Management Which .pdf
MCQ Pls Help ACC495 Corporate Governance and Risk Management Which .pdfMCQ Pls Help ACC495 Corporate Governance and Risk Management Which .pdf
MCQ Pls Help ACC495 Corporate Governance and Risk Management Which .pdf
 
Megan se gradu� de la universidad hace tres a�os y ha estado trabaja.pdf
Megan se gradu� de la universidad hace tres a�os y ha estado trabaja.pdfMegan se gradu� de la universidad hace tres a�os y ha estado trabaja.pdf
Megan se gradu� de la universidad hace tres a�os y ha estado trabaja.pdf
 
media luna pura Sarah Ryan, vicepresidenta de marketing de Portlan.pdf
media luna pura Sarah Ryan, vicepresidenta de marketing de Portlan.pdfmedia luna pura Sarah Ryan, vicepresidenta de marketing de Portlan.pdf
media luna pura Sarah Ryan, vicepresidenta de marketing de Portlan.pdf
 
my code doesnt work can you help me please the whole idea of is it i.pdf
my code doesnt work can you help me please the whole idea of is it i.pdfmy code doesnt work can you help me please the whole idea of is it i.pdf
my code doesnt work can you help me please the whole idea of is it i.pdf
 
Must be in C++ programming The main objective of this experiment i.pdf
Must be in C++ programming The main objective of this experiment i.pdfMust be in C++ programming The main objective of this experiment i.pdf
Must be in C++ programming The main objective of this experiment i.pdf
 
MUS monetary unit samplingA) What is the planned sample sizeB).pdf
MUS monetary unit samplingA) What is the planned sample sizeB).pdfMUS monetary unit samplingA) What is the planned sample sizeB).pdf
MUS monetary unit samplingA) What is the planned sample sizeB).pdf
 
Multifactor authentication (MFA) requires users to authenticate thei.pdf
Multifactor authentication (MFA) requires users to authenticate thei.pdfMultifactor authentication (MFA) requires users to authenticate thei.pdf
Multifactor authentication (MFA) requires users to authenticate thei.pdf
 
MTCR es una empresa l�der en el desarrollo y fabricaci�n de una ampl.pdf
MTCR es una empresa l�der en el desarrollo y fabricaci�n de una ampl.pdfMTCR es una empresa l�der en el desarrollo y fabricaci�n de una ampl.pdf
MTCR es una empresa l�der en el desarrollo y fabricaci�n de una ampl.pdf
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Recently uploaded (20)

SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 

May I please get help on this project in C++ I need to use the code .pdf

  • 1. May I please get help on this project in C++ I need to use the code displayed bottom of the screen. Ive been trying to code it but it's been tough. we need to use prototype function and call them up on the top of the main then call them inside. please help me out with thi so I can study. Thank you. project: C++ code given in class: #include #include using namespace std; //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>>& vec, const int maxc, const int maxr); 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); } } for(int i = 40; i <= 440; i++) { for(int j = 10; j <= 60; j++) {
  • 2. 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; } } //Horizontal part of T for(int i = 40; i <= 90; i++) { for(int j = 430; j <= 630; j++) { colors[i][j][0] = 0; colors[i][j][2] = 0; } } //Vertical part of T for(int i = 40; i <= 440; i++) { for(int j = 505; j <= 555; j++) { colors[i][j][0] = 0; colors[i][j][2] = 0; } } //Right vertical leg of N for(int i = 40; i <= 440; i++) { for(int j = 370; j <= 420; j++) { colors[i][j][0] = 0; colors[i][j][2] = 0; }
  • 3. } //Left vertical leg of N for(int i = 40; i <= 440; i++) { for(int j = 220; j <= 270; j++) { colors[i][j][0] = 0; colors[i][j][2] = 0; } } //Diagonal part of N for(int i = 40; i <= 440; i++) { int jm = (i-40)/2+220; int jb = max(220, jm-25); int je = min(420, jm+25); for(int j = jb; j <= je; j++) { colors[i][j][0] = 0; colors[i][j][2] = 0; } } ofstream fout("unt.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; } //initialize top half of the image with a white background void initializeTopHalf(uint8_t arr[][maxr][3], const int maxc, const int maxr) {
  • 4. // insert code } //initialize bottom half of the image with a white background vector>> initializeBottomHalf(const int maxc, const int maxr) { // insert code } //Fill top half with the characters CSCE void fillTopHalf(uint8_t arr[][maxr][3], const int maxc, const int maxr) { // insert code } //Fill bottom half with the characters UNT void fillBottomHalf(vector>>& vec, const int maxc, const int maxr) { //insert code } //Write top half to image file void writeTopHalf(ofstream& fout, uint8_t arr[][maxr][3], const int maxc, const int maxr) { // insert code } //Fill bottom half with the characters UNT void writeBottomHalf(ofstream& fout, vector>>& vec, const int maxc, const int maxr) { // insert code } 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
  • 5. 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);