Hey, I made i looked up toupper and made a little program out of it and have come to a little situation, When i enter the space character " " it does not output what i want and it just closes.

#include <iostream>

using namespace std;

int main()
{
    int i = 0;
    char text[20];
    
    cout << "Enter A Word (Letters Must All Be Lower Case) : ";
    cin >> text;
    
    while(text[i])
    {
                  putchar (toupper(text[i]));
                  i++;
    }
    
        
    cin.get();
    cin.get();
    
    return 0;
}

Thank you in advance.

replace line 11 with this

cin.getline(text,20)

hope that helps

commented: Good Answer, Thank You! +1
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.