Search:

Type: Posts; User: 7stud

Page 1 of 20 1 2 3 4

Search: Search took 0.03 seconds.

  1. Replies
    4
    Views
    381

    The universe is telling you that you picked the...

    The universe is telling you that you picked the wrong language. Next up: python.
  2. When you create a struct, you create a new...

    When you create a struct, you create a new type--just like int, double, float, etc. The new type is the name of the struct. Your vector has to declare what type of things it will contain. 'struct'...
  3. Thread: cstring

    by 7stud
    Replies
    9
    Views
    893

    Ok, now apply that same logic to this code: ...

    Ok, now apply that same logic to this code:

    string myStringErrors;
    ...
    std::getline(file,myStringErrors)
    ...
    const char* myStringNoSpaces = myStringErrors;
    string str(myStringNoSpaces);...
  4. struct is a C++ keyword, it is not a type. ...

    struct is a C++ keyword, it is not a type. Vectors must specify the type of the thing they hold. What type of things is your vector going to hold?
  5. Thread: cstring

    by 7stud
    Replies
    9
    Views
    893

    Well suppose your code did this: int num = 10;...

    Well suppose your code did this:

    int num = 10;
    int irrelevant = num;
    num = irrelevant;

    What would you do to make that code more efficient?
  6. Thread: cstring

    by 7stud
    Replies
    9
    Views
    893

    Whenever you ask a question about an error,...

    Whenever you ask a question about an error, ALWAYS post a message on the line that has the error, like this:


    int n = 10.5; //***ERROR***

    Or, post the error message along with the line of...
  7. Thread: cstring

    by 7stud
    Replies
    9
    Views
    893

    That's up to you to decide: const char* cstr =...

    That's up to you to decide:

    const char* cstr = "hello world goodbye world";

    string str(cstr); //cstring-->c++ string
    istringstream input(str); //creates a container called 'input', which ...
  8. Replies
    9
    Views
    959

    Thanks.

    Thanks.
  9. Replies
    15
    Views
    5,234

    Go Advanced/click on "Disable Smilies in text"...

    Go Advanced/click on "Disable Smilies in text" located below the textarea you type in.
  10. Replies
    9
    Views
    959

    What about: cin.ignore(cin.rdbuf()->in_avail()...

    What about:

    cin.ignore(cin.rdbuf()->in_avail() );
    vs.

    cin.ignore(numeric_limits<streamsize>::max(), '\n');
  11. Replies
    15
    Views
    5,234

    That's what virtual functions are for: you store...

    That's what virtual functions are for: you store everything in base class variables and then let polymorphism do its thing(i.e. call different transpose() functions depending on the type of the...
  12. Replies
    15
    Views
    5,234

    1) A derived type can be assigned to a variable...

    1) A derived type can be assigned to a variable of type base. That's because a base variable can be used to call all public functions and member variables in the base class. Since a derived...
  13. Thread: Class questions!

    by 7stud
    Replies
    7
    Views
    1,142

    You don't compile .h files, you include them. ...

    You don't compile .h files, you include them. Then the compiler will replace the include statement with the contents of the specified file. If the file contains only declarations of classes,...
  14. Replies
    9
    Views
    1,549

    You know this is a C++ forum, right?

    You know this is a C++ forum, right?
  15. Replies
    9
    Views
    1,549

    1) There's no such type as String or STring or...

    1) There's no such type as String or STring or strinG or striNG or strIng or sTrInG.

    2) The simplest way to add elements to a vector is by using a vector's push_back() method. There is also a...
  16. Replies
    9
    Views
    1,549

    All arrays are required to have sizes, so there...

    All arrays are required to have sizes, so there is no such thing as an "unsized array".

    Why not?
  17. Replies
    2
    Views
    978

    You don't declare structs or classes inside...

    You don't declare structs or classes inside main(). You do it outside main(). Likewise, you don't declare that sad, lonely char outside main--you do it inside main().

    Next time when you have...
  18. Replies
    8
    Views
    951

    You should never want to create a dynamic...

    You should never want to create a dynamic anything. If you are forced to, e.g. when you want to create an array that is based on the size of some user input, then you have to take care of deleting...
  19. Replies
    12
    Views
    18,886

    I don't think that is correct. I think c_str()...

    I don't think that is correct. I think c_str() is guaranteed to return you a cstyle string with a terminating '\0' regardless of what is stored internally in the string object. I haven't dug up the...
  20. Thread: Class help.

    by 7stud
    Replies
    5
    Views
    828

    I think you must be talking about these lines: ...

    I think you must be talking about these lines:

    33: void SetUpperLeft(Point Location) {itsUpperLeft = Location;}
    34: void SetLowerLeft(Point Location) {itsLowerLeft = Location;}...
  21. Replies
    8
    Views
    2,387

    Wow. Nice post.

    Wow. Nice post. <retreats out of the forum backwards, repeatedly bowing low to the ground>
  22. Replies
    12
    Views
    18,886

    Too ugly. All you need to do is copy the...

    Too ugly. All you need to do is copy the characters in the const cstring to the location of a non-constant variable you declare. You can use strcpy() if you want, or you can use this elegant...
  23. Thread: Class help.

    by 7stud
    Replies
    5
    Views
    828

    Hi, As you learned earlier, classes can...

    Hi,

    As you learned earlier, classes can contain data. For instance,

    class Data
    {
    public:
    Data(int n, double d) //constructor function
    {
    num = n;
  24. Replies
    9
    Views
    1,289

    double d;

    double d;
  25. Replies
    6
    Views
    7,074

    Your teacher made a mistake. You can write: ...

    Your teacher made a mistake. You can write:


    throw "some string";
    A simple example wouldn't involve creating and throwing an exception object(have you even studied objects yet?) Here is what a...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4