D
da Vinci
Hello,
I have a question regarding how to format input. I am at the beginners
level.
Basically, I am reading in a single character from the keyboard using
cin and I want to ensure that it is a capital letter. I looked into
using the formatting flag (uppercase) but the book I have specifies it
is only for cout. example: cout.setf(ios::uppercasse) ;
In the program I am writing now, I only have to deal with one
character. So I just used an if statement......
if ( another = 'n' )
another = 'N' ;
But what if there were options to have more than just one letter?
Maybe the user could enter a, b, c, d, e, or f. And you want it to be
put into a char variable in the uppercase format.
How would you accomplish that?
Thanks.
DV
I have a question regarding how to format input. I am at the beginners
level.
Basically, I am reading in a single character from the keyboard using
cin and I want to ensure that it is a capital letter. I looked into
using the formatting flag (uppercase) but the book I have specifies it
is only for cout. example: cout.setf(ios::uppercasse) ;
In the program I am writing now, I only have to deal with one
character. So I just used an if statement......
if ( another = 'n' )
another = 'N' ;
But what if there were options to have more than just one letter?
Maybe the user could enter a, b, c, d, e, or f. And you want it to be
put into a char variable in the uppercase format.
How would you accomplish that?
Thanks.
DV