I have said program:

#include <iostream>
#include <fstream.h>
#include <conio.h>

using std::cout;
using std::cin;
using std::ios;
using std::endl;

int main()
{
    char first[6];
    char middle[16];
    char last[16];
    int counter = 0;
    char temp;

    cout << "Please enter your first, middle, and last name:\n>";

    cin.get(first, 6);
    cin.ignore(80,'\n');
    cin.ignore(80, ' ');

    std::toupper(first[0]);

    cout << first << "333\n";
    return 0;

}

I originaly had it inputting in everything using a much more complicated method, but then found that this one would be easier. at the moment, it is currently reading in data from the user constantly. it should ony read in 6 (I'll be changing that later... this program is in the debugging stage right now :P ) characters at a time, and capitalizing the first letter of each word. I'm gting to the middle/last name later.

I know this program looks simple, and thats because it's a homework assignment. so don't write this prgram for me, tell e what I shuld do to write it.

What it needs to be able to do at this stage is to read in data from the user and capitalize the first letter of the word. that's it...

I talked with Narue briefly on IRC, and she said:

[20:11:25pm] <@Narue> Wait, you're reading from cin though. I bet the stream is in an error state.

that bit has me confused... I don't know what she means by that.. So narue, if you can help me there, that would be great. :)

Thanks,
Derek Elensar

P.S. Please excuse my speling mistakes... this keyboard sucks :P

Recommended Answers

All 3 Replies

Type a string, then hit enter, then type a space and hit enter again. That'll get you through the maze of ignores. ;) What exactly are you trying to accomplish here?

First, I don't think Narue is a dude. Second, I had this same post about 2 days ago, you may want to check out that thread. here

Ok, that makes sense... how can I incorporate both the cin.ignore statements into one?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.