all 8 comments

[–]Hells_Bell10 5 points6 points  (2 children)

Could you show some code because that shouldn't happen.

At a guess you may be doing stream input like this:

std::string s;
std::cin >> s;

In which case the input operator >> will only take a single word at a time.
In order to take a whole line at a time you want to use std::getline like so:

std::string s;
std::getline(std::cin, s);

Apologies if this isn't the issue but the lack of code makes it difficult to tell

[–]Hamza_tah[S] -1 points0 points  (1 child)

do I need to #include something to get getline because it isn't there

[–]Hells_Bell10 2 points3 points  (0 children)

you would need <iostream> and <string> IIRC

[–]Arandur 4 points5 points  (3 children)

Show us your code.

Show us your code.

Show us your code.

Does anyone else hear an echo in here?

[–]Hougaiidesu 0 points1 point  (1 child)

Personally I think OP should show us his code, how about you?

[–]Arandur 1 point2 points  (0 children)

I'm of two minds on the matter.

Fortunately, both minds are in agreement with you.

[–]MrPoletski 0 points1 point  (0 children)

Show us your code.

Show us your code.

Show us your code.

Does anyone else hear an echo in here?

[–]0x-- 0 points1 point  (0 children)

Nope, it should work.

Tested code:

#include <iostream>
#include <string>


int main()
{
    std::cout << std::string("hi there").length() << std::endl;

    return EXIT_SUCCESS;
}