Program to accept String starting with Capital letter | C ++ program to accept String starting with Capital letter ; Function to check if first character is Capital ; Function to check ; Driver function
#include <iostream> NEW_LINE using namespace std ; int checkIfStartsWithCapital ( string str ) { if ( str [ 0 ] >= ' A ' && str [ 0 ] <= ' Z ' ) return 1 ; else return 0 ; } void check ( string str ) { if ( checkIfStartsWithCapital ( str ) ) cout << " Accepted STRNEWLINE " ; else cout << " Not ▁ Accepted STRNEWLINE " ; } int main ( ) { string str = " GeeksforGeeks " ; check ( str ) ; str = " geeksforgeeks " ; check ( str ) ; return 0 ; }