C++ Online Compiler
Example: Reverse a Character in C++ using Library Function
C
C++
C#
Java
Python
PHP
main.cpp
STDIN
Run
// Reverse a Character in C++ using Library Function #include <iostream> #include <cctype> using namespace std; // cctype header file loaded to call the string functions int main() { char random_char; cout << "Enter an alphabet character to convert: "; cin >> random_char; cout << "\nThe Reverse case of the '" << random_char << "' is: '"; if (islower(random_char)) putchar(toupper(random_char)); else putchar(tolower(random_char)); cout << "'\n"; return 0; }
B
Output
Clear
ADVERTISEMENTS