Answers for "c++ check first character of string"

C++
2

c++ check first character of string

#include <iostream>
#include <string>

int main() 
{
  string str{};     // creating string
  getline(cin, str);// using getline for user input
  std::cout << str; // output string namePerson
  if (str[0] >= 'a' || str[0] <= 'z')
    str[0] -= 32;
  return (0);
}
Posted by: Guest on April-29-2021

Code answers related to "c++ check first character of string"

Browse Popular Code Answers by Language