subject

This program will output a right triangle based on user-specified height triangleHeight and symbol triangleChar.
(1) The given program outputs a fixed-height triangle using a * character. Modify the given program to output a right triangle that instead uses the user-specified triangleChar character.
(2) Modify the program to use a nested loop to output a right triangle of height triangleHeight. The first line will have one user-specified character, such as % or *. Each subsequent line will have one additional user-specified character until the number in the triangle's base reaches triangleHeight. Output a space after each user-specified character, including a line's last user-specified character.
Example output for triangleChar = % and triangleHeight = 5:
Enter a character: %
Enter triangle height: 5

%
% %
% % %
% % % %
% % % % %

#include
usingnamespacestd;
intmain()
{
char triangleChar='-';
inttriangleHeight=0;
cout<<"Enter a character: "< cin>>triangleChar;

cout<<"Enter triangle height: "<>triangleHeight;
cout<<"@"<<" "< cout<<"@"<<" "<<"@"<<" "< cout<<"@"<<" "<<"@"<<" "<<"@"<<" "<
return0;
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 04:30
Kyle, a receptionist for a building supply company, recently won an award for saving his company money on their phone system. after being presented with kyle's research, the company changed the way in which it made long-distance phone calls and cut their expenses in this area by 75 percent. the new system the kyle's company most likely adopted was wired communications switching stations voip hdtv
Answers: 3
question
Computers and Technology, 22.06.2019 10:30
Dave has to create animations for a game. which tool can dave use?
Answers: 3
question
Computers and Technology, 22.06.2019 18:00
What is the first view you place in your drawing?
Answers: 1
question
Computers and Technology, 22.06.2019 19:30
When creating a presentation in libre office impress, where does the editing of slides take place?
Answers: 1
You know the right answer?
This program will output a right triangle based on user-specified height triangleHeight and symbol t...
Questions
question
Computers and Technology, 08.05.2021 19:30
question
Mathematics, 08.05.2021 19:30
question
Physics, 08.05.2021 19:30
question
Mathematics, 08.05.2021 19:30