Line indicator
-
Help me, please, how do you put the line on the indicator so that you can't change from string to char*?
#include<iostream> #include<string> using namespace std; class Tree { string data; char *top; char*right; char*left;
public:
Tree()
{
getline(cin, data);
top = data;
right = NULL;
left = NULL;
}int count();//количество ветвей
};
-
If it is necessary to simply obtain a blue line indicator, a member function can be used
c_str()
forstd::string
♪If you need to copy a string show from
std::string
in pre-recorded memory, call for the replication functionstrcpy
:char s[100]; // следует выбрать достаточный размер для строки std::string data; ... strcpy(s, data.c_str());