Question: / / Copy / paste ( or type ) your code here / / Lab 1 template code, CS 1 4 1 / / Write
Copypaste or type your code here
Lab template code, CS
Write and run the tests for the individual problems one at a time.
#include
#include for setw and setfill
using namespace std;
main is where our program begins
int main
Create a height variable and get the input from the user
int height;
cout "Enter the height: ;
cin height;
Use a while loop to count up from to the height
int level ;
while level height
Note that just outputs one backslash: is a special character in C
so we just repeat it to clarify we really mean a backslash
endl starts for "end line" and will output a new line for us
As explained in Task setw specifies how many characters
should be output when we display the backslash
cout setwlevel endl;
Add one to level
level;
Now start at height, and count down to
level height;
while level
cout setwlevel endl;
Subtract one from level
level;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
