c++ first letter of string
#include <iostream>
#include <string>
int main() {
std::string inputString;
// Input
std::cout << "Enter a string: ";
std::getline(std::cin, inputString);
// Check if the string is not empty
if (!inputString.empty()) {
// Access and display the first letter
char firstLetter = inputString[0];
std::cout << "First letter of the string: " << firstLetter << std::endl;
} else {
std::cout << "The string is empty." << std::endl;
}
return 0;
}