c++ string problem

This is a discussion on c++ string problem within the C++ Programming forums, part of the General Programming Boards category; this is suppose to be a part for my game .
wut it does is,asks you for your characters name ...

c++ string problem

this is suppose to be a part for my game .
wut it does is,asks you for your characters name you give it,ask you for you characters class you type wut u want yur characters class to be but theres an error and im confused

<string.h> and <cstring> have the functions that work with C style strings, which are just null-terminated character arrays. The C++ string class is in <string> and is a class with its own member functions. You are using C style strings.

As for your code, there are several problems. You have >> instead of << in the cout line. You forgot the parentheses after cin.get. Inside the if, you declare a new variable and assign a value instead of using == to check for equality. You also have a call to strcat which is incorrect and does nothing right now.

Try starting off with a smaller program and add one thing at a time, making sure that one thing compiles and runs correctly before adding something else. I also recommend you use the C++ string class. It is easier to use and harder to mess up.

<string.h> and <cstring> have the functions that work with C style strings, which are just null-terminated character arrays. The C++ string class is in <string> and is a class with its own member functions. You are using C style strings.

Daved do u mean that with <string> strings are not null-terminated ?
what's the mechanism with <string> ?

Each implementation is free to implement string however they want. Generally they still use character arrays internally and just keep track of the length of the string. C++ strings are allowed to have null characters inside them, so they cannot use the null character as a marker for the end of the string.