Hello I have a question regarding the function length().
I want to find out the length of the string that is inputted by the user. When I use the length() function it only counts the characters from the first word. Can somebody please take a look at my code and determine why my code is only outputting the number of characters from the first word. For example: when the user inputs "hello" my program out puts 5, when the user inputs "hello world" the program still outputs 5.
#include <iostream>
#include <fstream>
#include <string>
#include <cctype>
#include <cstdio>
using namespace std;
int main()
{
string sentence;
cout<<"please enter a string: "<<endl;
cin>> sentence;
int length = sentence.length();
cout<< length;
cin.get();
}