Lower case to upper case | C ++ program to convert a string to uppercase ; Converts a string to uppercase ; Driver code
#include <iostream> NEW_LINE using namespace std ; string to_upper ( string & in ) { for ( int i = 0 ; i < in . length ( ) ; i ++ ) if ( ' a ' <= in [ i ] <= ' z ' ) in [ i ] = in [ i ] - ' a ' + ' A ' ; return in ; } int main ( ) { string str = " geeksforgeeks " ; cout << to_upper ( str ) ; return 0 ; }