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

Consider the program below that prints a triangle of characters (see an example

ID: 3545544 • Letter: C

Question

Consider the program below that prints a triangle of characters (see an example below). The program asks the user for the size and character to draw the triangle. The code below has several errors; find them, determine their types, and correct them.


#include<iostream> using namespace std;

int main() {

}

char TriangleChar; int size;

cout<<"Please enter a character to draw a triangle: "; cin>> TriangleChar;

cout<<" Please determine the size of the triangle: "; cin>>Size;

while(int i=0; i<Size; i++) {

for(int j=Size-i; j>0; j++); cout<<" ";

for(int k=1, k<=(2*i+1), k++) cout<<"*";

cout<<endl;
cout<<
" The values of iterators i,j,and k respectively: "<< i , j , k ;

system ("Pause"); return 0;


Consider the program below that prints a triangle of characters (see an example below). The program asks the user for the size and character to draw the triangle. The code below has several errors; find them, determine their types, and correct them.

Explanation / Answer

#include<iostream>

using namespace std;

int main()

{

char TriangleChar;

int size,i,k,j;

cout<<"Please enter a character to draw a triangle:";

cin>> TriangleChar;

cout<<" Please determine the size of the triangle: ";

cin>>size;

for(int i=0; i<size;i++)


for(int j=size-

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote