c+_+

#include

using namespace std;

int main ()
{

 int num;
 int i;
 int j;
 int d;
 char direction;

 cout<<"Please enter the character 'L' for Left and 'R' for right.";
 cin>>direction;
 cout<  
 cout<<"Please enter any number ";
 cin>>num;
 cout<

 switch (direction)
 {
 case 'r':
 case 'R':
  cout<<"The character is "<   
  for (i = 1; i <= num; i++)
  {
   for (j = 1; j <= i; j++)
   cout<<"X";
  cout<   }
  break;
 
 case 'l':
 case 'L':
  cout<<"The character is "<   
  for (i = 1; i <= num; i++)
  {
   for (d = num; d>= i; d--)
    cout<<" ";
   for (j = 1; j<= i; j++)
   cout<<"X";
  cout<   }
  break;
 default: 
  cout<<"Please enter the character appropriate for the program.";
 }

  
 return 0;

} 

Comments

You must be logged in to comment
No comments yet