Search:

Type: Posts; User: whiskedaway

Search: Search took 0.00 seconds.

  1. Replies
    13
    Views
    5,616

    Oh, that was what I was led to believe from above:

    Oh, that was what I was led to believe from above:
  2. Replies
    13
    Views
    5,616

    Nothing I try will compile. First I was getting...

    Nothing I try will compile. First I was getting that hour and min were undeclared, and then when I declared them I was getting an ambiguous overload.

    I'm not sure this part is as important as the...
  3. Replies
    13
    Views
    5,616

    Would it be a "."? Or maybe a " "? Or maybe it's...

    Would it be a "."? Or maybe a " "? Or maybe it's another variable to store the ":"? I'm not really sure.
  4. Replies
    13
    Views
    5,616

    If you're reversing stringstream, would you just...

    If you're reversing stringstream, would you just be reversing the arrows? So maybe:


    stringstream out;
    string time = in.str();
    out >> hour >> ":" >> min;
    int hour;
    int min;

    I'm not sure I...
  5. Replies
    13
    Views
    5,616

    Okay, so I have the wrong code then? I assumed...

    Okay, so I have the wrong code then? I assumed that getline(inFile, cLine) would take line number cLine in file inFile and read that line. From what you've said, I guess that's not correct? How would...
  6. Replies
    13
    Views
    5,616

    Alright, so I've ended up doing this and it...

    Alright, so I've ended up doing this and it compiles:


    for (int i=2; i < lineNo; i++) {
    string cLine;
    stringstream out;
    out << i;
    cLine = out.str();
    ...
  7. Replies
    13
    Views
    5,616

    Reading text file by line number

    This assignment is driving me insane!

    I have a text file that looks like this:

    3
    CODE TIME DESCRIPTION
    CODE TIME DESCRIPTION
    CODE TIME DESCRIPTION
    4
    CODE1 CODE2 TIME1 TIME2
  8. Replies
    1
    Views
    3,054

    Working out time duration

    Hi. I'm trying to create a program that will give the duration between two different times. The times are read in from a text file and are in the form "9:00", "11:00", "15:30", "17:00", etc. I am...
  9. Thank you! I knew it was a silly question. :D

    Thank you! I knew it was a silly question. :D
  10. Trying to print toString from object held in vector

    Apologies in advance if this is a really dumb question, but I'm pretty new at C++. Anyway, I have a Student object that has the following toString:


    string Student::toString() const {
    return...
  11. Replies
    3
    Views
    1,322

    Thanks so much, that explained everything. :)

    Thanks so much, that explained everything. :)
  12. Replies
    3
    Views
    1,322

    Clarification on operator overloading

    I am just starting out a course in C++ programming at university, and I've been given this line of code in a header file named Card.h:


    bool operator < (const Card& rhs) const;

    I'm meant to be...
Results 1 to 12 of 12