Guest_imported
New member
- Jan 1, 1970
- 0
Can anyone help???
This is what I have so far, but I can't seem to make it right. The output should be:
A
ABA
ABCBA
ABCDCBA
ABCDEDCBA
When the Letter 'E' is input. Any help be appreciated.
Cliff
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
void Inp(int, char);
void Outp(int, char);
int main()
{
char let = 'A';
int num = 0;
Inp(num, let);
return 0;
}
//**********************************************************
//**********************************************************
void Inp(/* inout */ int num,
/* inout */ char let)
{
do
{
cout <<"Please enter a letter: ";
cin >> let;
cout << "\n\n";
if (let < 'A' || let > 'z')
cout <<"Invalid Letter!!! Try Again \n\n\a";
} while (let < 'A' || let > 'z');
Outp (num, let);
}
//**********************************************************
//**********************************************************
void Outp(/* inout */ int num,
/* in */ char let)
{
char a, b, c='A', d, e='Z';
for (a='A';a<=let;a++)
{
for (b='A';b<e;b++)
cout<<" ";
for (d='A';d<=c;d++)
cout<<d;
cout<<"\n";
c++;
e--;
}
}
This is what I have so far, but I can't seem to make it right. The output should be:
A
ABA
ABCBA
ABCDCBA
ABCDEDCBA
When the Letter 'E' is input. Any help be appreciated.
Cliff
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
void Inp(int, char);
void Outp(int, char);
int main()
{
char let = 'A';
int num = 0;
Inp(num, let);
return 0;
}
//**********************************************************
//**********************************************************
void Inp(/* inout */ int num,
/* inout */ char let)
{
do
{
cout <<"Please enter a letter: ";
cin >> let;
cout << "\n\n";
if (let < 'A' || let > 'z')
cout <<"Invalid Letter!!! Try Again \n\n\a";
} while (let < 'A' || let > 'z');
Outp (num, let);
}
//**********************************************************
//**********************************************************
void Outp(/* inout */ int num,
/* in */ char let)
{
char a, b, c='A', d, e='Z';
for (a='A';a<=let;a++)
{
for (b='A';b<e;b++)
cout<<" ";
for (d='A';d<=c;d++)
cout<<d;
cout<<"\n";
c++;
e--;
}
}