c++ Can anyone tell me why I am getting this error and how i can fix it? *untitl
ID: 3674978 • Letter: C
Question
c++
Can anyone tell me why I am getting this error and how i can fix it?
*untitled.cox-C:UsersiKadeDocumentsCollegeC++-Geany (new instance) File Edit Search View Document Project Build Iools Help Save Save All Revert Close Back Forward Compile Build Execute Color Chooser Find Jump to Quit ew Symbols Documents nlDocum legelC++ untitled.cxx X 3 #include using namespace std; untitled.cxx 6 int main ) 7 int i 1; int j = 1; int k = 1; int p 11; int height = 3; int width = 5; 10 12 13 14 15 16 17 18 19 20 21 //get trunk height //get trunk width cin >> width; //get leaves width 23 2 4 25 2 6 27 cin >>p: //print the triangle for (i-1 ; iExplanation / Answer
Complete working code in Linux-Ubuntu OS
#include<iostream>
using namespace std;
int main(){
int i = 1;
int j = 1;
int k = 1;
int p = 11;
int height = 3;
int width = 5;
//get trunk height
cout<<"Enter trunk height:"<<endl;
cin>>height;
//get trunk width
cout<<"Enter trunk width:"<<endl;
cin>>width;
// get leaves width
cout<<"Enter leaves width:"<<endl;
cin>>p;
//printing the triangle pattern
for(i=1; i<=(p/2)+1; ++i) {
for(j=i; j<(p/2)+1; ++j) {
cout << ' ';
};
for(k=1; k<(i*2); ++k) {
cout << '*';
};
cout << ' ';
};
//print the rectangle pattern
for(i=0; i<height; ++i) {
cout << ' ';
for (j=0; j<width; ++j) {
cout << '*';
}
}
return 0;
}
/*
Output:
Enter trunk height:
6
Enter trunk width:
6
Enter leaves width:
5
*
***
*****
******
******
******
******
******
******
*/
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.