Elektrine lite

← Feed

@kasdeya@cryptid.cafe

Post #1762459

2026-04-28 23:26 UTC

formatting and printing values in C++ seems nice and normal and not insane at all 🙃 #include #include using namespace std; int main() { cout << fixed << showpoint << setprecision(2) << setw(9) << 34.789 << endl; cout << fixed << showpoint << setprecision(3) << setw(5) << 7.0 << endl; cout << fixed << noshowpoint << 5.789e12 << endl; cout << left << setw(7) << 67 << endl; }

Replies (1)

  • @kasdeya@cryptid.cafe 2026-04-28 23:30

    this language was definitely developed before people figured out how to make sane languages that make sense by the way, some of these cout directives only take effect for the next value to be printed, but others take effect forever! some of them also behave unpredictably and in ways that seemingly contradict the documentation! also, importing things in this language is a nightmare! there are basically two separate import systems stacked on top of each other, and both of them are terrible! if you want to import something you have to use both simultaneously which is a very smart and good decision also if you make any mistake whatsoever - no matter how small - C++ will just run with it and ruin everything and probably corrupt some memory while it’s at it too. it doesn’t care - there are no rules here. my LSP won’t warn me either this is not a language - this is 12 layers of x86 assembly preprocessors in a trenchcoat

    Open ##1762458