Alrighty, I know a ton about strings from Game Maker. But I don't know how long a string[256] is. How many letters can fit in that?
Alrighty, I know a ton about strings from Game Maker. But I don't know how long a string[256] is. How many letters can fit in that?
Last edited by Rune Hunter; 08-22-2004 at 09:50 AM.
if it is:
It can hold 255 characters and a null character.Code:char string[256];
alright making sure there thanks!
Here is the code...
Code:{ char answera[1]; char answerb[1]; char answerc[1]; cout<<"Here is the test...\n\n\n"; getch(); cout<<"question 1...\n\nWhat does blah blah mean?\n\nA. Start blah blah not importent.\nB. or answer 2.\n"; cin.getline(answera, 1, '\n'); cout<<"your answer was:"<<endl<<answera; getch(); mainmenu=1; }
whats wrong?
The fact that you are using a value of 1 for the array size. If it is to be a string then it has to have a null terminating character which means you have no room for the actual answer.
If you just want a character then just use a char instead of trying to hack it with a string.
uhh yes I see. I thought about nto using a string but I wanted to learn how actauly c++ strings work. But now that I do I am oging to use no string.
Thanks a ton again!!!!!
Well you weren't using c++ strings you were using c strings.
C string = a null terminated array of characters
C++ string = a class found in <string>
Dang it! Oh well.