Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

how to change string to lowercase and uperCase in c++

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

string uperCase(string input){
  transform(input.begin(), input.end(), input.begin(), ::toupper);
  return input;
};

string lowerCase(string input){
  transform(input.begin(), input.end(), input.begin(), ::tolower);
  return input;

};

int main()
{
  string input;

  cout <<"Please enter: ";
  cin >> input;

  cout << "Uper Case: "<<uperCase(input) << endl;
  cout << "Lower Case: "<<lowerCase(input) << endl;

}
 
PREVIOUS NEXT
Tagged: #change #string #lowercase #uperCase
ADD COMMENT
Topic
Name
2+6 =