• Xander Stevenson

A Small Win in C++

I haven't worked with C++ very much, but I'm required to for this project I'm working on. It reminds me of Java, which is good, because I'm familiar with Java, but bad, because these are both bulky, compiled and industrial motifs that are boring to look at, complex to work with and just ancient. But they're powerful.

I approached this project from a learning to become a better programmer point-of-view.

(Completey Accurate Analogy)

Damn, I miss Python. Lol. Anyway, after spending hours trying to manipulate floats, formatted to a certain length, into strings displayed to 2 digits, I ended up solving it by backing out of the functions and just formatting the answer with .resize().

This won't change the value of the answer, but truncates it's display length. It's not something a professional programmer should make a habit out of. I didn't solve the functional transformation as I wanted, but it was still a victory because it looks good and we're not doing anything else with the data beyond this display.

I could spend the next hour or two trying to solve the functions but why? I'm taking the small win and keeping my sanity. When the time comes to dig in and tackle the big problems in C++, I'll be ready. More ready now that I know the lay of the logical landscape of C++ and because I have a small win under my belt.

I can solve it, but I don't need to, so there is no reason to drive myself nuts over a language I might not use again for months or years.

13 views0 comments