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 18:00
Which of the following physical laws can make the flow of water seem more realistic? a. motion b. gravity c. fluid dynamics d. thermodynamics
Answers: 2
question
Computers and Technology, 24.06.2019 20:30
Which key should you press to leave the cell as it originally was? a. delete b. cancel c. backspace d. enter
Answers: 1
question
Computers and Technology, 25.06.2019 06:30
How can u permanently delete a picture from your camera ?
Answers: 1
question
Computers and Technology, 25.06.2019 12:00
What are the best ways to find data within a spreadsheet or database? check all that apply. sorting tools the function scrolling the search engine the search box
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
Mathematics, 20.04.2021 15:30
question
Computers and Technology, 20.04.2021 15:30
question
Mathematics, 20.04.2021 15:30
question
Mathematics, 20.04.2021 15:30
question
Mathematics, 20.04.2021 15:30
Questions on the website: 13722363