fork download
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4. int main() {
  5. char str[50];
  6. cout << "Enter the string: ";
  7. cin.getline(str, 50); int length = strlen(str);
  8. cout << "Length of the string is: " << length;
  9. return 0;
  10. }
Success #stdin #stdout 0s 5292KB
stdin
Standard input is empty
stdout
Enter the string: Length of the string is: 0