+ 1
Error when getting string as input in C++
I declare a variable as String type and while getting the input it shows error after pressing enter. How do I declare the variable to accept steering values without getting any errors..?
1 Réponse
+ 1
in the class to declare
ex
class string
{
char *name;
public:
string( char *s) // constructor
{
name=new char [strlen(s)+1];
strcpy(name,s);
}
};