chevron_left chevron_right
Login Register invert_colors photo_library


Stay updated and chat with others! - Join the Discord!
Thread Rating:
  • 0 Vote(s) - 0 Average


I Need Help With This Vector Problem filter_list
Author
Message
RE: I Need Help With This Vector Problem #11
(08-08-2019, 04:47 PM)Drako Wrote:
(08-08-2019, 04:02 AM)phyrrus9 Wrote:
(08-07-2019, 08:02 PM)Drako Wrote: I started doing that a while back when I read that endl was actually inefficient. What I read, and also heard from a lot of people was that it flushes and creates a newline. Which is unnecessary.

You'd be correct on it being inefficient, but the entirety of cout is that way. As for flushing the stream though, that's what std::flush is for.

I had already built the entire program with cout so I didn't want to try and use printf. Printf is a lot faster. As for my problem, any solutions?

which problem was that?

Reply

RE: I Need Help With This Vector Problem #12
(08-09-2019, 07:20 PM)phyrrus9 Wrote:
(08-08-2019, 04:47 PM)Drako Wrote:
(08-08-2019, 04:02 AM)phyrrus9 Wrote: You'd be correct on it being inefficient, but the entirety of cout is that way. As for flushing the stream though, that's what std::flush is for.

I had already built the entire program with cout so I didn't want to try and use printf. Printf is a lot faster. As for my problem, any solutions?

which problem was that?

My reply there. Do you at least have an idea on how I can solve it?
[Image: tumblr_n4fsswcwZa1sbhzgao1_250.gif]

"Crack it open, throw it in a pan and let it cook." ~ Filthy Franku

Reply

RE: I Need Help With This Vector Problem #13
(08-09-2019, 10:38 PM)Drako Wrote:
(08-09-2019, 07:20 PM)phyrrus9 Wrote:
(08-08-2019, 04:47 PM)Drako Wrote: I had already built the entire program with cout so I didn't want to try and use printf. Printf is a lot faster. As for my problem, any solutions?

which problem was that?

My reply there. Do you at least have an idea on how I can solve it?

Of using cout instead of printf? If it's not a real problem, I wouldn't worry about it. Going forward, if you can stand your codebase being unclean, use printf for new stuff. I was merely curious why you mixed the two

Reply

RE: I Need Help With This Vector Problem #14
(08-09-2019, 11:04 PM)phyrrus9 Wrote:
(08-09-2019, 10:38 PM)Drako Wrote:
(08-09-2019, 07:20 PM)phyrrus9 Wrote: which problem was that?

My reply there. Do you at least have an idea on how I can solve it?

Of using cout instead of printf? If it's not a real problem, I wouldn't worry about it. Going forward, if you can stand your codebase being unclean, use printf for new stuff. I was merely curious why you mixed the two

I quoted the wrong post...

I meant my code, and not cout and printf.

Code:
std::vector<int> infectChance = {5, 10, 15, 20, 25, 30, 35, 40, 45}; //List of possible infection chances

    std::cout << "  1 > Kin | Location Size: Large | Infection Chance: " << infectChance[0] << "%" << '\n' //Prints everything
                << "  Location Description - Kin is the largest location in the region, you'll" << '\n'
                << "  probably find lots of loot, but just as many bad guys.\n" << '\n'
                << "  2 > Military Outpost | Location Size: Large | Infection Chance: " << infectChance[1] << "%" << '\n'
                << "  Location Description - The government let us down. So does that mean" << '\n'
                << "  you can take their stuff now? Hell yes!\n" << '\n'
                << "  3 > Vernal | Location Size: Medium | Infection Chance: " << infectChance[2] << "%" << '\n'
                << "  Location Description - A pretty under-developed, rundown town." << '\n'
                << "  It's still got stuff though. Maybe.\n" << '\n'
                << "  4 > Mason | Location Size: Medium | Infection Chance: " << infectChance[3] << "%" << '\n'
                << "  Location Description - A better more developed Vernal. Go check it" << '\n'
                << "  out.\n" << '\n'
                << "  5 > Mavren | Location Size: Small | Infection Chance: " << infectChance[4] << "%" << '\n'
                << "  Location Description - OK, lets just make this short and sweet. it's" << '\n'
                << "  trailer park. Don't expect a thing.\n" << '\n'
                << "  6 > Return To Bunker\n" << '\n';
[Image: tumblr_n4fsswcwZa1sbhzgao1_250.gif]

"Crack it open, throw it in a pan and let it cook." ~ Filthy Franku

Reply






Users browsing this thread: 1 Guest(s)