Answers for "c++ char to uppercase"

C++
2

c++ char to uppercase

char choice; 
// it will instantly transform it to upper case without the need
// to convert it to int first
choice = (char)toupper(choice);
Posted by: Guest on December-30-2020
3

uppercase capitalise character in string c++

str[i] = toupper(str[i]);
Posted by: Guest on September-14-2020
2

convert all characters in string to uppercase c++

transform(str.begin(), str.end(), str.begin(), ::toupper);
Posted by: Guest on September-14-2020
0

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 << "\nIf it is a lowercase character, it will be converted to uppercase.";
    cout << "\n\nEnter a character. Press . to stop: ";

    cin >> letter;

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

    while(letter != '.')
    {
        cout << "\n\nEnter a character. Press . to stop: ";
        cin >> letter;

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

    return 0;
}
Posted by: Guest on May-31-2021
1

toupper c++

int result = toupper(charecterVariable);// return the int that corresponding upper case char
//if there is none then it will return the int for the original input.
//can convert int to char after
char result2 = (char)toupper(variableChar);
Posted by: Guest on October-11-2020

Browse Popular Code Answers by Language