SuperSid
asked on
New to C++. Need to know how to use a string.
How do i use a string?
I did #include <string.h>
but when i do
string x = "hello world";
cout<<x;
it's an error.. said "string" is an undeclared identifier..
I'm just really new to programming and don't even know how to use a string.
I'm trying to get the user to enter a number of words and then use if-then form to create a game for my final project.
thx
I did #include <string.h>
but when i do
string x = "hello world";
cout<<x;
it's an error.. said "string" is an undeclared identifier..
I'm just really new to programming and don't even know how to use a string.
I'm trying to get the user to enter a number of words and then use if-then form to create a game for my final project.
thx
try using:
#include <string>
instead of
#include <string.h>
you also might want to check out this link:
http://www.amberman.org/evolve/Software/strings/
#include <string>
instead of
#include <string.h>
you also might want to check out this link:
http://www.amberman.org/evolve/Software/strings/
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
#include <iostream.h>
#include <string.h>
int main (void)
{
string x = "hello world";
cout<<x<<"\n";
}
error: 'string' : unidentified modifier.