Search
 
SCRIPT & CODE EXAMPLE
 

CPP

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);
}
Comment

c++ check first character of string

int main() {
    string a="HELLO";
    cout<<a[0];
}
Comment

how to know the first letter of string c++

 string car = "audi";
    char firstCharacter= car.at(0);
    cout<< firstCharacter;
Comment

PREVIOUS NEXT
Code Example
Cpp :: pow c++ 
Cpp :: ? in cpp 
Cpp :: assign value to a pointer 
Cpp :: Maximum element in a map c++ 
Cpp :: binary to decimal 
Cpp :: c++ initialize size of 3d vector 
Cpp :: min heap 
Cpp :: queue 
Cpp :: c++ constructor 
Cpp :: reverse in vector c++ 
Cpp :: Check whether the jth object is in the subset 
Cpp :: bool nullable to bool c# 
Cpp :: c++ void poiinter 
Cpp :: building native binary with il2cpp unity 
Cpp :: lap trinh file explorer c++ 
Cpp :: arduino bleutooth module hc-05 with led 
Cpp :: c++ exeption handling 
Cpp :: how you can add intger value to string in c++ 
Cpp :: the number of ones int bitset 
Cpp :: jquery datepicker default date not working 
Cpp :: int and char in c++ compiler 
Cpp :: c plus 
Cpp :: multi variable assignment cpp 
Cpp :: cpp stacks 
Cpp :: passing array to the function c++ 
Cpp :: map::begin 
Cpp :: sfml hide message 
Cpp :: MPI_PUT 
Cpp :: run program until ctrl-d c++ 
Cpp :: c++ konsolenausgabe 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =