Answers for "casting a string to an uppercase c++"

C++
0

convert whole string to uppercase c++

#include<bits/stdc++.h> 
using namespace std; 
  
int main() 
{ 
    string s = "Viet Nam"; 
    transform(s.begin(), s.end(), s.begin(), ::toupper);  //uppercase
    cout << s << endl; 
    return 0; 
}
Posted by: Guest on March-27-2021
1

c++ convert lowercase to uppercase

/* toupper example */
#include <stdio.h>
#include <ctype.h>
int main ()
{
  int i=0;
  char str[]="Test String.n";
  char c;
  while (str[i])
  {
    c=str[i];
    putchar (toupper(c));
    i++;
  }
  return 0;
}
Posted by: Guest on September-08-2020

Browse Popular Code Answers by Language