Page 3 of 3 FirstFirst 123
Results 21 to 26 of 26
  1. #21
    Join Date
    Mar 2006
    Posts
    372
    Thanks for the info, owens. I have to admit I never used it.

    I'm curios why one would still use char[] or char* then.

  2. #22
    Join Date
    Jul 2006
    Location
    Israel
    Posts
    395
    omg what is so hard?

    just use string!!!

    #include <string>
    #include <iostream>
    using namespace std;

    string mystring = "kostya92";

    int main()
    {
    cout << "type something: ";
    getline(cin,mystring);
    if(mystring == "kostya92")
    {
    cout << "FIG1";
    }
    else
    {
    cout << "FIG2";
    }
    }

    happy now??

    edit: and leave this char[] or char* because its arrays and pointers you will learn it later all you need to know now its how to use this basics things i showed you.
    Last edited by kostya92; 03-26-2007 at 02:48 PM.

  3. #23
    Join Date
    Feb 2005
    Location
    Bellevue, WA
    Posts
    3,251
    When you're dealing with C++, you need to understand things like pointers and memory locations, and arrays (especially arrays). Just sweeping them under the floor and saying "stick to the basic stuff" isn't helping anyone learn anything.

    Also, using a string isn't always the right thing to be using. Learning about char*, char[], and the string class are all beneficial.

    "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." ~Rich Cook

  4. #24
    Join Date
    Mar 2006
    Posts
    372
    Quote Originally Posted by kostya92
    happy now??

    edit: and leave this char[] or char* because its arrays and pointers you will learn it later all you need to know now its how to use this basics things i showed you.
    I hope that wasn't pointed at me.

  5. #25
    Join Date
    Jul 2006
    Location
    Israel
    Posts
    395
    nope adryan its not to you its to milwal

    and owensd milwal is a beginer he no need to know about pointers and arrays right now he will learn it later after he finish the basics, do you agree with me owensd?

  6. #26
    Join Date
    Feb 2005
    Location
    Bellevue, WA
    Posts
    3,251
    Quote Originally Posted by kostya92
    nope adryan its not to you its to milwal

    and owensd milwal is a beginer he no need to know about pointers and arrays right now he will learn it later after he finish the basics, do you agree with me owensd?
    Pointers, probably not... however, arrays I think are fundamental to beginners so he should learn then now as they are part of the basics. Using the string class is all fine and dandy, but he's going to be seeing a lot of beginner examples that use char* and char[] and he will need to understand those in order to get the examples/tutorials.

    "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." ~Rich Cook

Page 3 of 3 FirstFirst 123

Posting Permissions

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