Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

convert letters to uppercase in c++

#include <iostream>
#include <string>
using namespace std;

int main()
{
    char letter;

    cout << "You will be asked to enter a character.";
    cout << "
If it is a lowercase character, it will be converted to uppercase.";
    cout << "

Enter a character. Press . to stop: ";

    cin >> letter;

    if(islower(letter))
    {
        letter = isupper(letter);
        cout << letter;
    }

    while(letter != '.')
    {
        cout << "

Enter a character. Press . to stop: ";
        cin >> letter;

        if(islower(letter))
        {
            letter = toupper(letter);
            cout << letter;
        }
    }

    return 0;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #convert #letters #uppercase
ADD COMMENT
Topic
Name
3+1 =