I thought you get 0xFF when space if pressed.... Now I'm off to find a reliable way to make sure cin never enters a failstate
I thought space was 0x20. . . Whatever it is, I am almost certain it isn't 0x00 , because Im pretty sure that is just a null character A.K.A \0
What are we talking about again?
Yes on the chart I have in front of me both 0x20 and 0xFF are spaces so I guess the terminating character is simply 0x00 or null. We were talking about helping me along with my factoring program which I have finished and its rock solid now thanks to these ways of checking the input.
One last question though.... does anyone happen to know if c++ allows you to manipulate super large numbers in ways other than using math libraries or writing your own functions to do math with arrays?
Anyhow I think 0x00 IS SPACE but you're right to it is at the same time terminating the char
make the experience and enter in cin>>here a char
and enter "blablabla thisisspace" and then look in the char.... I got only blablabla and the rest is lost...
Originally Posted by doofbla
Anyhow I think 0x00 IS SPACE but you're right to it is at the same time terminating the char
make the experience and enter in cin>>here a char
and enter "blablabla thisisspace" and then look in the char.... I got only blablabla and the rest is lost...
That is because "cin >>" uses whitespace to concatenate strings, I shall copy an excerpt from one of my favourite C++ Books:
Originally Posted by C++ Primer Plus, 5th edition
The problem lies with how cin determines when you’ve finished entering a string. You can’t
enter the null character from the keyboard, so cin needs some other means for locating the
end of a string. The cin technique is to use whitespace—spaces, tabs, and newlines—to delineate
a string. This means cin reads just one word when it gets input for a character array. After
it reads this word, cin automatically adds the terminating null character when it places the
string into the array.