how to generates words

I try do it. but i failed.

what i did i put it here.
i specify the characters i want to use it in making words.

[code]#include

using namespace std;

class makeWord
{
int vChB,vChE;
char *ch;

public:
makeWord()
{
ch=(char *)malloc(sizeof(char) * (1));
}
void setBeginCh(char c);
void setEndCh(char c);
void getWord(void);
};

void makeWord::setBeginCh(char c)
{
vChB=c;
}
void makeWord::setEndCh(char c)
{
vChE=c;
}
void makeWord::getWord(void)
{
*ch=vChB;
int i=0;
while(int(*ch)<=vChE)
{
cout << (i)+1 << " " << *ch << " |" << int(*ch) << "|" << vChE << "|" << endl;
*ch=int(*ch)+1;
i++;
}
}
int main()
{
char vChB,vChE;
cout << "Enter The Start Character: ";
cin >> vChB;
makeWord mWD;
mWD.setBeginCh(vChB);
cout << "Enter The End Character: ";
cin >> vChE;
mWD.setEndCh(vChE);
mWD.getWord();

return 0;
}
[/code]

i want do like this
-enter the length of the word
eg.
3
then it will generate word
aaa
aab
aac
aad
...
...
zzz

if any one would help me
and please explain to me
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories