Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

i need to draw a pattern with C++ using standart out, i need to be using loops,

ID: 3749808 • Letter: I

Question

i need to draw a pattern with C++ using standart out, i need to be using loops, swicth statements, functions, const int variables, structs, enums(to store the shapes to be drawn and for the colors which are black and white), and an array to create a simple drawing application. Users will be able to select a shape to draw that will be printed out to the standard output. There will be no need for a sophisticated graphics library or windowing system as all output will be performed by std::cout. the first graphics application will be able to draw a 10 x 10 pattern. The patterns of the application will draw are: filled, a checkerboard, a square, an x and an upper left triangle

Explanation / Answer

#include <iostream>

using namespace std;

void printxrow(){

for(int i=0;i<=10;i++){

if(i%2==0)cout<<"x";

else cout<<" ";

}

}

void printsrow(){

for(int i=0;i<=10;i++){

if(i%2==0)cout<<" ";

else cout<<"x";

}

}

int main() {

int choice;

cout<<"1)filled 2)checkerboard 3)square 4) X 5)upper left triangle choose a shape form menu:";

cin>>choice;

switch(choice){

case 1:

cout<<endl;

for(int i=0;i<10;i++){

for(int j=0;j<10;j++){

cout<<"xx";

}

cout<<endl;

}

break;

case 2:

cout<<endl;

for(int i=0;i<5;i++){

printxrow();

cout<<endl;

printsrow();

cout<<endl;

}

break;

case 3:

cout<<endl;

for(int i=0;i<10;i++){

for(int j=0;j<19;j++){

if(i==0||i==9)

{

if(j%2==0)cout<<"x";

else cout<<" ";

}

else if(j==0||j==18)cout<<"x";

else cout<<" ";

}

cout<<endl;

}

break;

case 4:

cout<<endl;

for(int i=0;i<=10;i++){

for(int j=0;j<=10;j++){

if(j==i||j==10-i) cout<<"x";

else cout<<" ";

}

cout<<endl;

}

break;

case 5:

cout<<endl;

for(int i=10;i>0;i--){

for(int j=0;j<i;j++){

cout<<"x";

}

cout<<endl;

}

break;

default:

cout<<"choose a number from displayed menu"<<endl;

}

}

/*Sample ouput:

*/