Results 1 to 4 of 4

Thread: What type?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2001
    Location
    Upstate NY
    Posts
    210

    What type?

    what type do i declare something if i want it to be able to hold multiple characters? i've tried string but it doesn't exist, do i need to add a special library?
    < o >

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    you need to include string if you want to use it:
    #include <string>
    you can also use character arrays
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    To use string as a datatype (as in VB):
    Code:
    #include <string>
    
    using namespace std;
    
    void main()
    {
    	string mystr = "something";
    	mystr = mystr + "something else"
    }
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  4. #4
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Of course you can use char arrays.
    Code:
    char mystr[] = "something"
    //will have to use functions like strcpy etc.
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width