toupper Function Problems!
Hey Guys,
I asked this question before but I can't figure it out.
string Articles [5] = {"a", "the" ,"one" , "some" ,"any" };
string Nouns [5] = {"man", "tree" ,"dog" , "car" ,"town" };
string Verbs [5] = {"drove","jumped", "ran" ,"walked" , "threw"};
string Prepositions [5] ={"to","from", "over" ,"under" , "through"};
example I'm using a ramdon number to display different sencentes but how could I use toupper to make the first character of the articles a capital letter
I have something like this: Sentence(num) is just a function that generates a random number.
Code:
for ( int i = 0; i <= number_lines; i++)
{
cout << " " << Articles[Sentence(num)] << " " << Nouns[Sentence(num)]
<< " " << Verbs [Sentence(num)] << " " << Prepositions[Sentence(num)]
<< " " << Articles[Sentence(num)] << " " << Nouns[Sentence(num)] << ".\n";
}
The first character of Article[Sentence(num)] should be a capital letter but the next Article just be lower case .
so I can have something like
A car crashed to one tree
When I try to access the first character on the string I use
Code:
char ch = Articles[Sentence(num)][0]
ch = toupper(ch)
how could I copy the first character to after a make it a capital letter?
Please some help
Thank you
Dilmer Valecillos
I already read the tutorials in this website please give me some other help !