Thread: Using 'if' with char arrays or string objects

  1. #31
    Registered User
    Join Date
    Apr 2002
    Posts
    249

    Then the problem from your compiler

    Then the problem from the compiler itselff...

    or I don't know..
    it is realy confusable.//../
    C++
    The best

  2. #32
    Registered User
    Join Date
    Apr 2002
    Posts
    48
    .........

    So should i re-instal visual c++?...





    :*(
    Hey, you gotta start somewhere

  3. #33
    Registered User
    Join Date
    Apr 2002
    Posts
    48
    does anybody know how i can fix this problem?
    Hey, you gotta start somewhere

  4. #34
    Unregistered
    Guest

    Try this.

    Code:
    #include <iostream>
    #include <string>
    
    int main()
    {
    	std::string str1;
    	str1 = "Hello World!";
    	std::cout << str1;
    	return 0;
    }
    See if you can make that code run. I haven't seen anyone including the std namespace when declaring string objects in this thread...

  5. #35
    Registered User
    Join Date
    Apr 2002
    Posts
    48
    yes that works... but how come everyone else can get the code to work without using namespaces.

    [edit]
    And plus I never used to have to do that... weird... but thx... but that's still weird...
    Hey, you gotta start somewhere

  6. #36
    Unregistered
    Guest
    I don't know how others can do it without using accessing namespace. Maybe their compilers are old? I don't think older versions of standard include files (iostream.h, string.h, etc., but not the headers without ".h") defined the std namespace.

  7. #37
    Ryce
    Guest

    yea

    well dont feel to bad, i use VC++ 6.0 and i could never just use string.

    example:
    Code:
    #include <iostream.h>
    #include <string.h>
    int main()
    {
    string cat; // This never works
    char *cat; // thats what i end up useing.
    return 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. String issues
    By The_professor in forum C++ Programming
    Replies: 7
    Last Post: 06-12-2007, 09:11 AM
  2. Passing pointers to arrays of char arrays
    By bobthebullet990 in forum C Programming
    Replies: 5
    Last Post: 03-31-2006, 05:31 AM
  3. lvp string...
    By Magma in forum C++ Programming
    Replies: 4
    Last Post: 02-27-2003, 12:03 AM