teh supar faggort1
05-05-2001, 03:23 AM
Well... I have a question about a program I am messing with... I realize this is not a Linux question but I figured you all are much more knowledgable than many... So... Here's my problem. Almost all of it works, but then there is one section of code that doesn't... Can someone give me a hand? Thanks...
Here's the code:
===========================
#include "UTILITY2.inc"
#include "APVECTOR.H"
typedef apvector <char> ListType;
void EnterList(ListType &List);
void DisplayAll(ListType List);
void DisplayVowels(ListType List);
void DisplayConsonants(ListType List);
void main()
{
OutputSelection();
// Heading H("29","MM-DD-YY","100","RANDOM LETTERS");
Execution();
ListType List;
do
{
EnterList(List);
DisplayAll(List);
DisplayVowels(List);
DisplayConsonants(List);
}
while (NotFinished());
Terminate();
}
void EnterList(ListType &List)
{
int Length,K = 0;
Skip(4);
Title("Function Random Letter List");
Skip(2);
cout<<"How many letters will be generated ---> ";
cin>>Length;
List.resize(Length);
for(K=0; K < Length;K++)
{
List[K] = random(25)+65;
}
}
void DisplayAll(ListType List)
{
Skip(4);
Title("Display all Letters");
Skip(2);
int K = 0;
int Length = List.length();
for (K = 0; K < Length; K++)
{
cout << List[K] <<" ";
}
getch();
}
void DisplayVowels(ListType List)
{
int K = 0;
int Length = List.length();
Skip(4);
Title("Display of Vowel Letters");
Skip(2);
for (K = 0; K < Length; K++)
{
switch(List[K])
{
case 'A':
cout<<List[K]<<" ";
break;
case 'E':
cout<<List[K]<<" ";
break;
case 'I':
cout<<List[K]<<" ";
break;
case 'O':
cout<<List[K]<<" ";
break;
case 'U':
cout<<List[K]<<" ";
break;
}
}
getch();
}
void DisplayConsonants(ListType List)
{
int K = 0;
int Length = List.length();
bool Vowel = false;
Skip(4);
Title("Display of Consonant Letters");
Skip(2);
for (K=0; K < Length; K++)
{
Vowel = false;
switch(List[K])
{
case 'A':
Vowel = true; break;
case 'E':
Vowel = true; break;
case 'I':
Vowel = true; break;
case 'O':
Vowel = true; break;
case 'U':
Vowel = true; break;
if(Vowel == false)
cout<<List[K]<<" ";
}
}
}
===================
DisplayConsonants() does not work correctly... I am guessing it is some logic problem, but I have been staring at it for the last half hour and can't figure it out... Thanks for the help!
Here's the code:
===========================
#include "UTILITY2.inc"
#include "APVECTOR.H"
typedef apvector <char> ListType;
void EnterList(ListType &List);
void DisplayAll(ListType List);
void DisplayVowels(ListType List);
void DisplayConsonants(ListType List);
void main()
{
OutputSelection();
// Heading H("29","MM-DD-YY","100","RANDOM LETTERS");
Execution();
ListType List;
do
{
EnterList(List);
DisplayAll(List);
DisplayVowels(List);
DisplayConsonants(List);
}
while (NotFinished());
Terminate();
}
void EnterList(ListType &List)
{
int Length,K = 0;
Skip(4);
Title("Function Random Letter List");
Skip(2);
cout<<"How many letters will be generated ---> ";
cin>>Length;
List.resize(Length);
for(K=0; K < Length;K++)
{
List[K] = random(25)+65;
}
}
void DisplayAll(ListType List)
{
Skip(4);
Title("Display all Letters");
Skip(2);
int K = 0;
int Length = List.length();
for (K = 0; K < Length; K++)
{
cout << List[K] <<" ";
}
getch();
}
void DisplayVowels(ListType List)
{
int K = 0;
int Length = List.length();
Skip(4);
Title("Display of Vowel Letters");
Skip(2);
for (K = 0; K < Length; K++)
{
switch(List[K])
{
case 'A':
cout<<List[K]<<" ";
break;
case 'E':
cout<<List[K]<<" ";
break;
case 'I':
cout<<List[K]<<" ";
break;
case 'O':
cout<<List[K]<<" ";
break;
case 'U':
cout<<List[K]<<" ";
break;
}
}
getch();
}
void DisplayConsonants(ListType List)
{
int K = 0;
int Length = List.length();
bool Vowel = false;
Skip(4);
Title("Display of Consonant Letters");
Skip(2);
for (K=0; K < Length; K++)
{
Vowel = false;
switch(List[K])
{
case 'A':
Vowel = true; break;
case 'E':
Vowel = true; break;
case 'I':
Vowel = true; break;
case 'O':
Vowel = true; break;
case 'U':
Vowel = true; break;
if(Vowel == false)
cout<<List[K]<<" ";
}
}
}
===================
DisplayConsonants() does not work correctly... I am guessing it is some logic problem, but I have been staring at it for the last half hour and can't figure it out... Thanks for the help!