Computers and Technology

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;
}

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 07:00, sugaree95
What are three software programs for mobile computing?
Answers: 1
image
Computers and Technology, 23.06.2019 07:10, anika420
If you want to import a picture into a dtp application, what must you do first? draw an image frame. import text. open the folder containing the file. select get image… from the windows menu.
Answers: 2
image
Computers and Technology, 23.06.2019 07:30, Braxtonw875
What part of the interface displays the external references contained in a selected cell? the status bar the review tab the scroll bar the formula bar
Answers: 1
image
Computers and Technology, 24.06.2019 07:30, Isabellawuzhere
Aproject involves many computing systems working together on disjointed task towards a single goal what form of computing would the project be using
Answers: 3
Do you know the correct answer?
This program will output a right triangle based on user-specified height triangleHeight and symbol t...

Questions in other subjects:

Konu
English, 26.03.2021 08:10
Konu
Mathematics, 26.03.2021 08:10
Konu
Chemistry, 26.03.2021 08:10
Konu
Mathematics, 26.03.2021 08:10
Konu
Biology, 26.03.2021 08:10