Use of string class in c++
-
My C++ compiler is not accepting string as a predefined class. No objects of string class could be created.
-
My C++ compiler is not accepting string as a predefined class. No objects of string class could be created.
Do you mean the std::string? Did you add the #include
-
My C++ compiler is not accepting string as a predefined class. No objects of string class could be created.
Hello, some more details would be helpful! Do you mean std::string ? If this is the case did you include ? :
#include
then use std::string :
std::string astring("a string");
-
Hello, some more details would be helpful! Do you mean std::string ? If this is the case did you include ? :
#include
then use std::string :
std::string astring("a string");
I've included the header file but "using namespace std" this line is also not working.
-
I've included the header file but "using namespace std" this line is also not working.
-
I've included the header file but "using namespace std" this line is also not working.
I agree with other messages, we can not guess everything. My best guess is that you are compiling a C file? (not C++)...
-
I agree with other messages, we can not guess everything. My best guess is that you are compiling a C file? (not C++)...
-
Or, he could be using an ancient version of C++, like maybe Borland Turbo C++, that doesn't understand namespaces.
-
I've included the header file but "using namespace std" this line is also not working.
-
The following code should compile (and run) fine in a decent (i.e. reasonable recent) compiler
#include using namespace std;
int main()
{
const string greetings = "Hello world!";
cout << greetings << endl;
}Try adding #include ;)
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
-
Try adding #include ;)
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)