nick81
asked on
String (newb)
Hi all,
At this tutorial site(http://cplus.about.com/library/weekly/aa051202b.htm) it says that to create a string all i have to do is
1) #include <string>
then
2) string thisIsAString
and that's it.
but it doesn't work! i'm sure it's something stupid that i'm doing
i use MS vis. c++ 6.0
thx nick
At this tutorial site(http://cplus.about.com/library/weekly/aa051202b.htm) it says that to create a string all i have to do is
1) #include <string>
then
2) string thisIsAString
and that's it.
but it doesn't work! i'm sure it's something stupid that i'm doing
i use MS vis. c++ 6.0
thx nick
#import <string>
using namespace std;
...
string myString;
OR
#import <string>
...
std::string myString;
!!!
using namespace std;
...
string myString;
OR
#import <string>
...
std::string myString;
!!!
Sample code
#include <iostream>
#include <string>
int main () {
string str1 = "Hello" ;
string str2 ( "World" ) ;
string str3 = str1 + str2 ;
cout << str1 ;
cout << str2 ;
cout << str3 ;
}
Amit
#include <iostream>
#include <string>
int main () {
string str1 = "Hello" ;
string str2 ( "World" ) ;
string str3 = str1 + str2 ;
cout << str1 ;
cout << str2 ;
cout << str3 ;
}
Amit
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
monkesdb,
VC++6.0 doesn't require it
But yep, others do require
Amit
VC++6.0 doesn't require it
But yep, others do require
Amit
ASKER
I forgot the namespace, very stupid. thx everyone. monkesdb did mention it so i'll give him the points.
ASKER
vc++ 6.0 doesn't require it? well it didn't work when i didn't use using namespace std;
nick
nick
What problem r u facing
POst ur code
Amit