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 :: cpp map iterate over keys 
Cpp :: opencv c++ hello world 
Cpp :: c++ shared pointer 
Cpp :: sum of vector elements c++ 
Cpp :: how to add numbers in c++ 
Cpp :: queue implementation using linked list in cpp 
Cpp :: c++ infinite for loop 
Cpp :: c++ merge sort 
Cpp :: arduino buildin let 
Cpp :: calculator c++ 
Cpp :: c++ read image opencv in folder 
Cpp :: cases in cpp 
Cpp :: how to do nCr in c++ 
Cpp :: change to lowercase character c++ 
Cpp :: copy a part of a vector in another in c++ 
Cpp :: rand c++ 
Cpp :: ue4 c++ enumaeration 
Cpp :: string stream in c++ 
Cpp :: cpp ifstream 
Cpp :: how to scan array in c++ 
Cpp :: convert string toupper and tolower in cpp 
Cpp :: log base 10 c++ 
Cpp :: c++ binary search 
Cpp :: hello world program in c++ 
Cpp :: c++ inherit from class template 
Cpp :: powershell get uptime remote computer 
Cpp :: print octal number in c++ 
Cpp :: Reverse Level Order Traversal cpp 
Cpp :: how to set a variable to infinity in c++ 
Cpp :: Program To Calculate Number Power Using Recursion In C++. The power number should always be positive integer. 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =