fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. int main()
  5. {
  6. std::cout << "Please input a sentence:" << std::endl;
  7. std::string sentence;
  8. std::getline(std::cin, sentence);
  9. std::cout << "The sentence you entered was "
  10. << sentence.length()
  11. << " characters long." << std::endl;
  12. }
  13.  
Success #stdin #stdout 0s 2988KB
stdin
This is a sentence.
stdout
Please input a sentence:
The sentence you entered was 19 characters long.