Declaring strings in Plato3?

This is a discussion on Declaring strings in Plato3? within the C++ Programming forums, part of the General Programming Boards category; Hi, I'm new to this forum and fairly new to C++. I have been doing some of the tutorial on ...

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    10

    Declaring strings in Plato3?

    Hi, I'm new to this forum and fairly new to C++. I have been doing some of the tutorial on this site, however my compiler seems to have different commands to the ones used here. In particular I cannot figure out how to declare a string variable! I include string.h and that works fine.
    I was just wondering if anyone knows what code I need to declare a string?
    Thankyou

    Edit: My compiler is named 'Plato3'!

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,618
    Plato3 appears to be a text editor or an IDE, not a C++ compiler. What C++ compiler are you using with Plato3?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    Why don't you get like VC++ 2005 or 2008 from microsoft? Also the header for string is doesnt have an .h it is #include <string>. Last but not least the code to declare a string
    Code:
    std::string my_string;
    although if you look at the http://www.cprogramming.com website youll find a slue of tutorials, and one that answers this very question.

  4. #4
    Registered User
    Join Date
    Feb 2008
    Posts
    10
    Ok, I think I'll get VC++ then, if I can. I don't really understand what I have as when I have written other code in this Plato thing it will only build and run if i put .h on the libraries(?) I want to include. Thankyou for suggesting VC++ though.

  5. #5
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    Most C++ headers do not have the .h extension ( the older counterparts still hold them ). Usually the .h headers are deprecated or out of date.

  6. #6
    Registered User
    Join Date
    Feb 2008
    Posts
    10
    Oh right, ok. Well I have Visual C++ now, although am still a bit confused. Why is there a separate folder for header files? If I have to include the header files in the .cpp file anyway, why not just write 'include<whatever>' at the top of the .cpp files?

    PS. Sorry for these stupid questions!

  7. #7
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,618
    Why is there a separate folder for header files? If I have to include the header files in the .cpp file anyway, why not just write 'include<whatever>' at the top of the .cpp files?
    It's a logical separation. The header files are still kept in the same directory unless you specify otherwise.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. declaring strings?
    By s_jsstevens in forum C Programming
    Replies: 5
    Last Post: 04-16-2007, 08:53 PM
  2. Strings Program
    By limergal in forum C++ Programming
    Replies: 4
    Last Post: 12-02-2006, 02:24 PM
  3. Programming using strings
    By jlu0418 in forum C++ Programming
    Replies: 5
    Last Post: 11-26-2006, 07:07 PM
  4. declaring array of strings dynamically!!!!
    By Real in forum C Programming
    Replies: 1
    Last Post: 08-29-2003, 06:59 AM
  5. am I declaring my strings wrong?
    By sunburnbyRA in forum C++ Programming
    Replies: 7
    Last Post: 03-06-2003, 04:42 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21