?
Solved

String (newb)

Posted on 2004-04-15
7
Medium Priority
?
280 Views
Last Modified: 2010-04-01
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
0
Comment
Question by:nick81
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 10

Expert Comment

by:Sys_Prog
ID: 10832960
That's what u need
What problem r u facing

POst ur code

Amit
0
 
LVL 3

Expert Comment

by:monkesdb
ID: 10832965
#import <string>
using namespace std;

...

string myString;


OR

#import <string>

...

std::string myString;

!!!
0
 
LVL 10

Expert Comment

by:Sys_Prog
ID: 10832971
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
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Accepted Solution

by:
monkesdb earned 200 total points
ID: 10832985
Sys_Frog

you still need to state which namespace it's in !!!
0
 
LVL 10

Expert Comment

by:Sys_Prog
ID: 10833222
monkesdb,

VC++6.0 doesn't require it
But yep, others do require

Amit
0
 

Author Comment

by:nick81
ID: 10833269
I forgot the namespace, very stupid. thx everyone. monkesdb did mention it so i'll give him the points.
0
 

Author Comment

by:nick81
ID: 10833282
vc++ 6.0 doesn't require it? well it didn't work when i didn't use using namespace std;

nick
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question