Results 1 to 25 of 25
  1. - Top - End - #1
    Titan in the Playground
     
    Silverraptor's Avatar

    Join Date
    Feb 2009
    Location
    A nice, sparkly place.
    Gender
    Male

    Default C++ problem help please

    I'm trying to figure out doing a problem in C++. Problem is, I haven't done C++ in over a year and I'm blanking on terminology and such. I have a general idea how to do the questions, but the specifics are blanking on me. Anyone want to help me out?

    The question I'm trying to answer is:
    In C++ - write code to print the following: The daily fine for an overdue library book is 10 cents for the first day and increases by 1 cent for each succeeding day that is, 11 cents for the second day, 12 cents for the 3rd day and so on. The total fine is the sum of the daily fines. Given the user input of n days late, print out the number of days late along with the average daily fine.
    Thanks in advance.

  2. - Top - End - #2
    Barbarian in the Playground
     
    DwarfClericGuy

    Join Date
    Nov 2016
    Location
    SoCal
    Gender
    Male

    Default Re: C++ problem help please

    Off the top of my head and being extremely tired after recovering from surgery, I would say:

    10N + ( (N * ( N - 1)) / 2)

  3. - Top - End - #3
    Barbarian in the Playground
     
    NecromancerGuy

    Join Date
    Apr 2010
    Location
    Night Vale
    Gender
    Male

    Default Re: C++ problem help please

    Quote Originally Posted by Silverraptor View Post
    I'm trying to figure out doing a problem in C++. Problem is, I haven't done C++ in over a year and I'm blanking on terminology and such. I have a general idea how to do the questions, but the specifics are blanking on me. Anyone want to help me out?

    The question I'm trying to answer is:
    In C++ - write code to print the following: The daily fine for an overdue library book is 10 cents for the first day and increases by 1 cent for each succeeding day that is, 11 cents for the second day, 12 cents for the 3rd day and so on. The total fine is the sum of the daily fines. Given the user input of n days late, print out the number of days late along with the average daily fine.
    Thanks in advance.
    What specifically are you having trouble with? User input, algorithm design, function definition, printing? It's hard to help without feeling like I'm doing homework for you with that broad of a question.
    Avatar by TheGiant
    B.S. in Statistics - University of Minnesota <- as of May 2017, still pretty excited : )
    Long-form Sig

  4. - Top - End - #4
    Titan in the Playground
     
    Silverraptor's Avatar

    Join Date
    Feb 2009
    Location
    A nice, sparkly place.
    Gender
    Male

    Default Re: C++ problem help please

    Quote Originally Posted by Astral Avenger View Post
    What specifically are you having trouble with? User input, algorithm design, function definition, printing? It's hard to help without feeling like I'm doing homework for you with that broad of a question.
    Well, so far I have this:

    #include<iostream>

    using namespace std;

    void main()
    {
    int n;

    cout << "Number of days late :";
    cin>>n;

    for (
    {
    cout << "Your fine is " << (n + 1) << "cents."
    }
    I know it's not much, and probably a step in the wrong direction somewhere, but that's as much as I remember. I'm trying to figure out how to get the value of input 'n' output 10+1n. And I'm drawing a blank on it.
    Last edited by Silverraptor; 2017-10-14 at 08:42 PM.

  5. - Top - End - #5
    Barbarian in the Playground
     
    DwarfClericGuy

    Join Date
    Nov 2016
    Location
    SoCal
    Gender
    Male

    Default Re: C++ problem help please

    You don't need a for loop.

  6. - Top - End - #6
    Barbarian in the Playground
     
    NecromancerGuy

    Join Date
    Apr 2010
    Location
    Night Vale
    Gender
    Male

    Default Re: C++ problem help please

    Quote Originally Posted by Silverraptor View Post
    Well, so far I have this:
    Code:
    #include<iostream>
    
    using namespace std;
    
    void main()
    {
    int n;
    
    cout << "Number of days late :";
    cin>>n;
    
    for (
    {
    cout << "Your fine is " << (n + 1) << "cents."
    }
    I know it's not much, and probably a step in the wrong direction somewhere, but that's as much as I remember. I'm trying to figure out how to get the value of input 'n' output 10+1n. And I'm drawing a blank on it.
    Code:
    cout << "Your fine is " << (9+n) << "cents."
    My reading of the problem is $0.10 on day 1 and 1 additional cent every subsequent day, so 9+n = 10c on first day, 11c on second, 12c on third, etc.
    Biggest correction I would make would be add a data scrubber, to check that n isn't 0 or negative. Simple if statement should be enough for that.

    Secondary thing I would add is a check so that if the fine >= 100 cents it writes it as x dollars and y cents (substitute local currency as necessary).
    Last edited by Astral Avenger; 2017-10-14 at 08:52 PM.
    Avatar by TheGiant
    B.S. in Statistics - University of Minnesota <- as of May 2017, still pretty excited : )
    Long-form Sig

  7. - Top - End - #7
    Titan in the Playground
     
    Silverraptor's Avatar

    Join Date
    Feb 2009
    Location
    A nice, sparkly place.
    Gender
    Male

    Default Re: C++ problem help please

    So, if I make it instead:

    Code:
    #include<iostream>
    
    using namespace std;
    
    void main()
    {
    int n;
    
    cout << "Number of days late :";
    cin>>n;
    
    cout << "Your fine is " << (n + 9) << "cents."
    
    return 0;
    }
    Would that do it? And if so, I'm trying to think about how to properly make the check you mentioned. You're right, I never considered the dollar conversion for 100 cents. Probably will need to have an if/else statement.

    Having the first be "if (n + 9) < 100, << cout << "Your fine is " << (n + 9) << "cents."

    Then the else would be along the lines of "if (n+9) > 100, ..." or something like that. Will I need to add another value, (like k)? Something for stored value for dollars where 1 "k" = 100 "n".
    Last edited by Silverraptor; 2017-10-14 at 09:15 PM.

  8. - Top - End - #8
    Barbarian in the Playground
     
    NecromancerGuy

    Join Date
    Apr 2010
    Location
    Night Vale
    Gender
    Male

    Default Re: C++ problem help please

    Quote Originally Posted by Silverraptor View Post
    So, if I make it instead:
    *snip*
    Would that do it? And if so, I'm trying to think about how to properly make the check you mentioned. You're right, I never considered the dollar conversion for 100 cents. Probably will need to have an if/else statement.

    Having the first be "if (n + 9) < 100, << cout << "Your fine is " << (n + 9) << "cents."

    Then the else would be along the lines of "if (n+9) > 100, ..." or something like that. Will I need to add another value, (like k)? Something for stored value for dollars where 1 "k" = 100 "n".
    That should do it for the first part of the problem unless i'm misreading it. Doubles are your friend with money (until you can write a class definition of your own and make it do what you want). I tend to program in functions, so I'd probably do something along the lines of:
    Code:
    #include<iostream>
    
    using namespace std;
    
    void main()
    {
    int n;
    double fee;
    
    double fine(int n){
        if(n<1){
            return 0;
        }
        double fee=0.09;
        fee += .01*n;
        return fee;
    }
    
    cout << "Number of days late :";
    cin>>n;
    
    fee = fine(n);
    
    cout << "Your fine is $" << fee <<".";
    
    return 0;
    }
    Avatar by TheGiant
    B.S. in Statistics - University of Minnesota <- as of May 2017, still pretty excited : )
    Long-form Sig

  9. - Top - End - #9
    Dwarf in the Playground
     
    OldWizardGuy

    Join Date
    Nov 2010
    Location
    California
    Gender
    Male

    Default Re: C++ problem help please

    I think you are misreading the problem. The daily fine increases by one cent a day, but the total fine is the sum of the daily fines.

    So I think the fine calculator is more like:

    Code:
    // Fine in cents.
    int fine(int days) {
      int total = 0;
      for (int day = 1; day <= days; ++day) {
        int daily_fine = 9 + day;
        total += daily_fine;
      }
      return total;
    }
    And the average daily file is total fine / days.
    Last edited by Sermil; 2017-10-14 at 10:18 PM.

  10. - Top - End - #10
    Barbarian in the Playground
     
    NecromancerGuy

    Join Date
    Apr 2010
    Location
    Night Vale
    Gender
    Male

    Default Re: C++ problem help please

    Quote Originally Posted by Sermil View Post
    I think you are misreading the problem. The daily fine increases by one cent a day, but the total fine is the sum of the daily fines.

    So I think the fine calculator is more like:

    Code:
    // Fine in cents.
    int fine(int days) {
      int total = 0;
      for (int day = 1; day <= days; ++day) {
        int daily_fine = 9 + day;
        total += daily_fine;
      }
      return total;
    }
    And the average daily file is total fine / days.
    I do believe you are correct, one of those things that seem super obvious in retrospect. I think you could work out the formula for the fine and not need a for loop, but given how trivial this loop is, you'd probably loose out on efficiency in taking the time to do that rather than let the processor run in O(n) rather than O(1).
    Avatar by TheGiant
    B.S. in Statistics - University of Minnesota <- as of May 2017, still pretty excited : )
    Long-form Sig

  11. - Top - End - #11
    Titan in the Playground
     
    Silverraptor's Avatar

    Join Date
    Feb 2009
    Location
    A nice, sparkly place.
    Gender
    Male

    Default Re: C++ problem help please

    Quote Originally Posted by Astral Avenger View Post
    That should do it for the first part of the problem unless i'm misreading it. Doubles are your friend with money (until you can write a class definition of your own and make it do what you want). I tend to program in functions, so I'd probably do something along the lines of:
    Code:
    #include<iostream>
    
    using namespace std;
    
    void main()
    {
    int n;
    double fee;
    
    double fine(int n){
        if(n<1){
            return 0;
        }
        double fee=0.09;
        fee += .01*n;
        return fee;
    }
    
    cout << "Number of days late :";
    cin>>n;
    
    fee = fine(n);
    
    cout << "Your fine is $" << fee <<".";
    
    return 0;
    }
    What exactly does doubles do again? I'm also trying to refresh my memory on terminology in C++ as well.

    Quote Originally Posted by Sermil View Post
    I think you are misreading the problem. The daily fine increases by one cent a day, but the total fine is the sum of the daily fines.

    So I think the fine calculator is more like:

    Code:
    // Fine in cents.
    int fine(int days) {
      int total = 0;
      for (int day = 1; day <= days; ++day) {
        int daily_fine = 9 + day;
        total += daily_fine;
      }
      return total;
    }
    And the average daily file is total fine / days.
    Let me see if I completely understand this code. Under the function of 'fine' with the integer titled 'days', set the in value to 0 then with the for loop set with day starting at 1 and day less-than or equal to days, increasing the value of day (I think that's what ++day means). Then of course the integer 'daily_fine' is equal to 9 plus the value of day (or n) with the total equaling daily_fine? Did I say that correct? Sorry for asking trivial questions, but I am really rusty at C++ and trying to get back into the swing of it. (Also, why is total '+=' to the int 'daily_fine'?)

  12. - Top - End - #12
    Barbarian in the Playground
     
    NecromancerGuy

    Join Date
    Apr 2010
    Location
    Night Vale
    Gender
    Male

    Default Re: C++ problem help please

    Quote Originally Posted by Silverraptor View Post
    What exactly does doubles do again? I'm also trying to refresh my memory on terminology in C++ as well.



    Let me see if I completely understand this code. Under the function of 'fine' with the integer titled 'days', set the in value to 0 then with the for loop set with day starting at 1 and day less-than or equal to days, increasing the value of day (I think that's what ++day means). Then of course the integer 'daily_fine' is equal to 9 plus the value of day (or n) with the total equaling daily_fine? Did I say that correct? Sorry for asking trivial questions, but I am really rusty at C++ and trying to get back into the swing of it. (Also, why is total '+=' to the int 'daily_fine'?)
    Doubles are one of the data types built into c++, they store numeric values but are not limited to integers. The name comes from using double the memory of an int.
    The basic classes in c/c++ off the top of my head are int, double, bool (true/false), char (character), str (strings of characters, can reference parts of strings as a char array). Int also has unsigned int, which makes it able to handle bigger numbers than a normal int, but can't go negative, and long int, which doubles the maximum values int can store, but also doubles the memory it uses (distinct from doubles by still being limited to integer values).

    I'll leave sermil to comment on their code, i think you got it right, but I'm reading it on my phone, so mistakes may have been missed.
    Avatar by TheGiant
    B.S. in Statistics - University of Minnesota <- as of May 2017, still pretty excited : )
    Long-form Sig

  13. - Top - End - #13
    Titan in the Playground
     
    BlackDragon

    Join Date
    Feb 2007
    Location
    Manchester, UK
    Gender
    Male

    Default Re: C++ problem help please

    Quote Originally Posted by Astral Avenger View Post
    The name comes from using double the memory of an int.
    No, the name comes from them being double precision as compared to "float", which is the other type of floating-point variable C and C++ support.

    Have to say, I probably wouldn't use them for this problem, though, because floating-point precision errors are a thing and you add those errors with every addition you make--so if you enter a really large number of days you might end up with oddities like a fine of 1110.0000000034 cents*, or something like that. Less likely to happen with doubles as opposed to floats, admittedly, but I'd just store the cents value of the fine as an integer and then process that for display appropriately.

    * Note: I haven't calculated to see if 1110 is an actual value you could get as a fine, I just used it as an example of a big number.

  14. - Top - End - #14
    Surgebinder in the Playground Moderator
     
    Douglas's Avatar

    Join Date
    Aug 2005
    Location
    Mountain View, CA
    Gender
    Male

    Default Re: C++ problem help please

    Quote Originally Posted by Silverraptor View Post
    (Also, why is total '+=' to the int 'daily_fine'?)
    "+=" means "increase by". It's (almost) equivalent to "total = total + daily_fine". The difference is a technical detail that's rarely relevant.
    Like 4X (aka Civilization-like) gaming? Know programming? Interested in game development? Take a look.

    Avatar by Ceika.

    Archives:
    Spoiler
    Show
    Saberhagen's Twelve Swords, some homebrew artifacts for 3.5 (please comment)
    Isstinen Tonche for ECL 74 playtesting.
    Team Solars: Powergaming beyond your wildest imagining, without infinite loops or epic. Yes, the DM asked for it.
    Arcane Swordsage: Making it actually work (homebrew)

  15. - Top - End - #15
    Firbolg in the Playground
     
    ElfRangerGuy

    Join Date
    Aug 2007
    Location
    Imagination Land
    Gender
    Male

    Default Re: C++ problem help please

    Quote Originally Posted by Silverraptor View Post
    You're right, I never considered the dollar conversion for 100 cents. Probably will need to have an if/else statement.

    Having the first be "if (n + 9) < 100, << cout << "Your fine is " << (n + 9) << "cents."

    Then the else would be along the lines of "if (n+9) > 100, ..." or something like that.
    I don't have a lot to add to this thread since it's been pretty well covered by others. However, I just wanted to point out that you're missing an "if (n+9) == 100" case here in this cents to dollars conversion logic. You are only checking "(n+9) < 100" and "(n+9) > 100", but have nothing for when the fine is exactly one dollar.

    I know we've already determined that the total fine isn't simply "n+9 cents", but you get the idea....
    "Nothing you can't spell will ever work." - Will Rogers

    "What you must learn is that these rules are no different than the rules of a computer system. Some of them can be bent. Others can be broken." - Morpheus, The Matrix

    Quote Originally Posted by Krellen View Post
    Remember, Evil isn't "selfish". It's Evil. "Look out for number one" is a Neutral attitude. Evil looks out for number one while crushing number two.

  16. - Top - End - #16
    Titan in the Playground
     
    BlackDragon

    Join Date
    Feb 2007
    Location
    Manchester, UK
    Gender
    Male

    Default Re: C++ problem help please

    Quote Originally Posted by KillianHawkeye View Post
    You are only checking "(n+9) < 100" and "(n+9) > 100", but have nothing for when the fine is exactly one dollar.
    I don't think it's actually possible for the fine to be exactly a dollar? According to my calculations it jumps straight from 91 cents to $1.08.

  17. - Top - End - #17
    Barbarian in the Playground
     
    DwarfClericGuy

    Join Date
    Nov 2016
    Location
    SoCal
    Gender
    Male

    Default Re: C++ problem help please

    Quote Originally Posted by factotum View Post
    I don't think it's actually possible for the fine to be exactly a dollar? According to my calculations it jumps straight from 91 cents to $1.08.
    You are correct.

    Day: 0, total fine: 0, AvgDailyFine: 0
    Day: 1, total fine: 10, AvgDailyFine: 10
    Day: 2, total fine: 21, AvgDailyFine: 10.5
    Day: 3, total fine: 33, AvgDailyFine: 11
    Day: 4, total fine: 46, AvgDailyFine: 11.5
    Day: 5, total fine: 60, AvgDailyFine: 12
    Day: 6, total fine: 75, AvgDailyFine: 12.5
    Day: 7, total fine: 91, AvgDailyFine: 13
    Day: 8, total fine: 108, AvgDailyFine: 13.5
    Day: 9, total fine: 126, AvgDailyFine: 14
    Day: 10, total fine: 145, AvgDailyFine: 14.5
    Day: 11, total fine: 165, AvgDailyFine: 15
    Day: 12, total fine: 186, AvgDailyFine: 15.5
    Day: 13, total fine: 208, AvgDailyFine: 16
    Day: 14, total fine: 231, AvgDailyFine: 16.5
    Day: 15, total fine: 255, AvgDailyFine: 17
    Day: 16, total fine: 280, AvgDailyFine: 17.5
    Day: 17, total fine: 306, AvgDailyFine: 18
    Day: 18, total fine: 333, AvgDailyFine: 18.5
    Day: 19, total fine: 361, AvgDailyFine: 19

  18. - Top - End - #18
    Titan in the Playground
     
    Silverraptor's Avatar

    Join Date
    Feb 2009
    Location
    A nice, sparkly place.
    Gender
    Male

    Default Re: C++ problem help please

    I just want to thank everyone so much for there help. Given how rusty I am with coding after not doing it for a while, every bit of information helped me out immensely.

  19. - Top - End - #19
    Ettin in the Playground
     
    RedWizardGuy

    Join Date
    Oct 2009
    Location
    Not a great place
    Gender
    Male

    Default Re: C++ problem help please

    I know you've got your answer now, but here's how I'd do it. I'd start with your code.

    #include<iostream>

    using namespace std;

    void main()
    {
    int n;

    cout << "Number of days late :";
    cin>>n;

    for (
    {
    cout << "Your fine is " << (n + 1) << "cents."
    }
    Up to there, and change it so it looks like this.

    Code:
    #include<iostream>
    
    using namespace std;
    
    void main() {
      while (true) {
        int dayslate;
        cout << "Number of days late :\n";
        cin>>dayslate;
    
        float fine = 0.1;
        int count = 1;
        float totalfine = 0;
    
        while (count <= dayslate){
          totalfine = totalfine + fine;
    
          count++
          fine = fine + 0.01;
        }
    
        cout << "Total fine: $" << totalfine << "\n";
    
        cout << "Please input data for next fine.\n";
      }
      return 0;
    }
    I know I probably should set the length of the decimal part of the output, but I'm tired.

    As a side note, I've come to hate it when single character variable names are used. I know some are traditional, especially i for loop durations and n for integers, but if you make your variable names meaningful then they're easier to track and you have to comment your code less.

    Also, I used the while loop so you can get fine after fine, if I was actually writing this code as a program I'd personally have made this a function called by inputting the correct keyword (likely "fine" in this case), and made the main function a while loop holding 'cout << "please enter function.\n"; cin >> keyword;' and then a switch or if-elseif statement that takes the keyword and calls the correct function (or just says 'return 0;' if told to exit). But that's outside the scope of this problem.

    Oh, and always end your couts with "\n" unless you're going to append something to the same line. It's just nicer while testing.
    Last edited by Anonymouswizard; 2017-10-15 at 04:31 PM.
    I prefer science fiction to fantasy, and generally play in the former genre. Due to this, I generally expect the laws of physics to apply to games, and work from that perspective.

    Spoiler: playground quotes
    Show
    Quote Originally Posted by Zelphas View Post
    So here I am, trapped in my laboratory, trying to create a Mechabeast that's powerful enough to take down the howling horde outside my door, but also won't join them once it realizes what I've done...twentieth time's the charm, right?
    Quote Originally Posted by Lord Raziere View Post
    How about a Jovian Uplift stuck in a Case morph? it makes so little sense.

  20. - Top - End - #20
    Firbolg in the Playground
     
    ElfRangerGuy

    Join Date
    Aug 2007
    Location
    Imagination Land
    Gender
    Male

    Default Re: C++ problem help please

    Quote Originally Posted by factotum View Post
    I don't think it's actually possible for the fine to be exactly a dollar? According to my calculations it jumps straight from 91 cents to $1.08.
    You should still be checking for that case, because your "display more than 99 cents as x dollars and y cents" function should be agnostic about what kind of input it will be receiving. It's just a best practices thing.

    Similarly, you should also check for when the leftover cents are less than 10 so that you can add in the floating 0. Otherwise, two dollars and five cents will display as $2.5, which looks pretty confusing.
    Last edited by KillianHawkeye; 2017-10-19 at 05:04 PM.
    "Nothing you can't spell will ever work." - Will Rogers

    "What you must learn is that these rules are no different than the rules of a computer system. Some of them can be bent. Others can be broken." - Morpheus, The Matrix

    Quote Originally Posted by Krellen View Post
    Remember, Evil isn't "selfish". It's Evil. "Look out for number one" is a Neutral attitude. Evil looks out for number one while crushing number two.

  21. - Top - End - #21
    Ogre in the Playground
     
    OldWizardGuy

    Join Date
    Aug 2010

    Default Re: C++ problem help please

    Quote Originally Posted by Anonymouswizard View Post
    Oh, and always end your couts with "\n" unless you're going to append something to the same line. It's just nicer while testing.
    Nitpick: Use std::endl rather than '\n' (presuming you're using STL, which I am considering you said for cout).
    "Gosh 2D8HP, you are so very correct (and also good looking)"

  22. - Top - End - #22
    Titan in the Playground
     
    Knaight's Avatar

    Join Date
    Aug 2008

    Default Re: C++ problem help please

    Quote Originally Posted by Astral Avenger View Post
    I do believe you are correct, one of those things that seem super obvious in retrospect. I think you could work out the formula for the fine and not need a for loop, but given how trivial this loop is, you'd probably loose out on efficiency in taking the time to do that rather than let the processor run in O(n) rather than O(1).
    It's not a particularly difficult formula, and it's one calculation instead of one per loop. There's no reason to use a for loop here, it's a simple arithmetic series. The easiest depiction of the formula (plus the average) would be
    Code:
    $tot=n(19+n)/200
    $avg=.095+n/200
    although directly using the dollar sign as a variable is a bit unorthodox and really shouldn't make its way into a program. If you want a display in cents for low values that's another few lines, but this is about a five line program in something like MATLAB.

    Also, technically speaking it looks like there's no need to ever calculate the total fine in the problem statement.

  23. - Top - End - #23
    Barbarian in the Playground
     
    BardGuy

    Join Date
    Feb 2010
    Location
    UK
    Gender
    Male

    Default Re: C++ problem help please

    Quote Originally Posted by kyoryu View Post
    Nitpick: Use std::endl rather than '\n' (presuming you're using STL, which I am considering you said for cout).
    Don't do this! std::endl; also does a flush, which is expensive (six times more expensive than '\n') and unnecessary. This was the subject of a lightning talk (3:13) at this year's CppCon, but represents the recent wisdom in C++ for some time now: https://stackoverflow.com/questions/...always-be-used


  24. - Top - End - #24
    Ettin in the Playground
     
    RedWizardGuy

    Join Date
    Oct 2009
    Location
    Not a great place
    Gender
    Male

    Default Re: C++ problem help please

    Quote Originally Posted by kyoryu View Post
    Nitpick: Use std::endl rather than '\n' (presuming you're using STL, which I am considering you said for cout).
    Eh, if given the choice I still go for good old printf because it's what I learnt first and I find it more powerful (although I need to brush up on the formatting notation again). I'll also default to scanf because I believe that you should always have to have your data type in mind when accepting input, and I won't 90% if I'm using cin.

    I once used stdio.h in my university C++ course exam because I'm more comfortable with it.
    I prefer science fiction to fantasy, and generally play in the former genre. Due to this, I generally expect the laws of physics to apply to games, and work from that perspective.

    Spoiler: playground quotes
    Show
    Quote Originally Posted by Zelphas View Post
    So here I am, trapped in my laboratory, trying to create a Mechabeast that's powerful enough to take down the howling horde outside my door, but also won't join them once it realizes what I've done...twentieth time's the charm, right?
    Quote Originally Posted by Lord Raziere View Post
    How about a Jovian Uplift stuck in a Case morph? it makes so little sense.

  25. - Top - End - #25
    Dwarf in the Playground
     
    DwarfBarbarianGuy

    Join Date
    Jul 2016

    Default Re: C++ problem help please

    Quote Originally Posted by Capt Spanner View Post
    Don't do this! std::endl; also does a flush, which is expensive (six times more expensive than '\n') and unnecessary. This was the subject of a lightning talk (3:13) at this year's CppCon, but represents the recent wisdom in C++ for some time now: https://stackoverflow.com/questions/...always-be-used
    wow, i've been coding in c++ for awhile and i had no idea about that! just been using endl like it's synonymous with \n. this mad science forum has some interesting threads and posts!
    check out my D&D-inspired video game, not done yet but you can listen to the soundtrack if you're bored: https://www.facebook.com/TheCityofScales/

    my game's soundcloud: https://soundcloud.com/user-77807407...les-soundtrack

    i qualify for improved disarm! lol. though i have taken martial arts i don't think i actually have the feat though

Posting Permissions

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