Member Avatar for Brian Perrigan
#include <iostream>
#include <stdio.h> 
using namespace std ;

int main ()
{
    char c ;
    c = cin.get () ;
    do 
        { 
        cout.put (toupper (c)) ; c = cin.get () ; 
        }
    while ( !cin.eof () ) ;     
}

How can I make this capitalize only the first letter of the word? I've been trying for hours and I cannot figure it out. I have to use isspace (int)

I want to set up an if else loop, but I cannot get it to work.

Rather than getting it character by character, why don't you read the word into a std::string and capitalize that? Hint: std::strings are arrays and can have their chars changed one by one if necessary.

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.