Hi,
I am trying to figure out how to make a program read 1 character at a time but have run into a snag. When I enter my data, my first character entered does not print. Is there a way to fix this in my loop?
I know using normal strings and arrays would be much easier but I am trying to learn more about character manipulation here.
An example of the input out put is this:
[input]: Hello world
[output]: ello world
[input]: Hello world
[output]: Hello world.
<EOF>
You can see that the first output 'H' is missing and it is because of the way my loop is incremented but I do not know how to fix this.
The code I have is:
Also, Is there a way to make sure that first (and only the first) letter is always converted to a Capital with all of the rest lower?Code:#include<iostream> #include<cctype> using namespace std; int main() { char text_main; int count; text_main = 0; count = 0; cin.get(text_main); while(text_main != '.') { count++; cin.get(text_main); cout << text_main; } cout << endl; return 0; }
Any ideals?