Testing class or algorithm in c++

>testing class or algorithm in c++
>have to spend 3x as much time formatting the console stream input/output as you do actually writing the fucking thing you want to test

God this language is such a pain in the ass

Attached: 1544811233703.jpg (689x720, 297K)

intro to programming 101

It's not for noobs. Stick to python Rajesh.

>it's obtuse and I'm smart for liking it!!!

what's the point of having to use ~a dozen different methods with such a failure prone system when other languages do it so much more efficiently? just admit that it's outdated and obtuse.

C++ formatting really is a hot pile of garbage.

C++ is a fucking awful meme-lang. Drop that shit.

i have a c++ class and i fucking hate it
java might be verbose but at least pass by reference makes sense
what's the point of a pointer if you have to use pointers to pointers half the time since you have to pass a value to mutate?
at least java will tell you if you're passing by reference right and you dont find out from segfaults

friend, I spent 8 hours today writing an interface with only 8 methods.

there are 10 source files that transpiled into 15 other files...

I haven't written a single line of code that does anything yet

welcome to programming I guess.

begone, js """developer'""

I'm trying to do as shit a job as I can so I get promoted as soon as possible.

I don't understand why I have to code when I have a cs degree while we have all these journos without a job.

what? I don’t have this issue in C++. C however....

I actually find writing C++ comfy especially when you’re good with the STL.

C++ has references though, and you could just pass a reference to a pointer instead of a pointer to a pointer to solve your second issue.

I like most things about c++ but iostream can be a pain to work with.

Its not that bad desu
Dealing with getops is a bit annoying but it works well and is pretty simple

Oh you said C++
Not sure if it's any different compared to C

>echo("C++ BAD")
nu Jow Forums is worst Jow Forums

Use rust instead where most of the pain is making sure your shit passes the compiler's test.

It's tremendously bad though.

more like
printf("\n\tsometext %i\n", x);

>\n\t
why are either of those necessary for the former half of the char* array?

That's not C++, that's C

In C++ it would be

cout

C++ has printf() though?

What do you mean?
\n is for a new line \t is a tabulation? They aren't necessary in any way?

Well it was in reference to OPs post about formatting outputs and how he made it sound difficult.

>hey aren't necessary in any way?
no, not at the beginning of a string like the example given.

oh

>no, not at the beginning of a string like the example given.
the reason I used "\n\t" at the beginning was that it's a really easy way to format output text to make it immediately noticeable

>other languages do it so much more efficiently
they actually do it less efficiently in favor of programmer convenience.
if you need to format your console output you can use a library or write your own. That's programming and you don't seem to like it so why do you bother?

fair enough.

it does, just tested it.

The statement that C is a subset of C++ is quite literally true, which is why C++ tends to be a bit bloated, since there's more than one way to print a string.

cout and cin are very explicit but a bit akward imo.

>The statement that C is a subset of C++ is quite literally true
int *ptr = malloc(sizeof *ptr);

>writing a program in python
>popular library is completely undocumented
>waste 20x as much time reading the source as you do writing your program

test.cpp:6:19: error: invalid conversion from ‘void*’ to ‘int*’ [-fpermissive]
int *ptr = malloc(sizeof *ptr);
~~~~~~^~~~~~~~~~~~~


explain yourself.

That's his argument to that moronic statement. C++ unironically has a semi sound type system

That's the problem with C++, yes.
It is very low level, so shit takes longer to do on it, unless you download a library to do the job for you.

>~a dozen different methods
>C++ formatting really is a hot pile of garbage.
Something tells me you're doing something wrong.
Here's how you format shit in C++.

To stdout or any stream:
std::cout

C++ formatting is done in a way where it is at least clear what in the fuck is going on and where the compiler can possibly optimize it. Printf is literally a shitty dsl with unclear and super gross rules around conversions and whatnot. Sure the printf is succinct, but from a typing standpoint cout and the

Now print a float with 1 decimal of precision, and then another float using the default.

>where the compiler can possibly optimize it
That doesn't explain why C++ streams always fail to stdio when it comes to benchmarking.
C++ iostreams call all sorts of functions and carry all sorts of retarded implicit state. They also have the disadvantage of hard-coding the order of the arguments (hurts internationalisation systems) and just being ugly as fuck.

I'm not familiar with said benchmarks and I don't know.

>import a module which is a wrapper for module which is a wrapper for two other modules that do some magic written in C

all these fags sayin it's easy just spamming cout, now try reading some data from the keyboard with failure checks.... lmao. the very fact that cin can go into a failed state is fucking retarded

C# is superior

Outside of naming convention can you really compare the two? There are so many differences

Install Visual Studio (not vscode) and learn to use its debugger. If you're on linux... I guess CLion isn't bad. XCode is decent, but again I'd start with VS. I use vim for a lot of things— python, erlang, latex... but time is money and I don't have time for bjarney to suck my toes and not pay me for my services. Especially when you get into things like OpenGL. There's a reason AAA game studios use it. Yes, their codebases are a lot bigger than the fizzbuzz collection you keep for /dpt/ threads, but you'll get there someday.

Attached: 1500x500.jpg (1500x500, 165K)

>java might be verbose but at least pass by reference makes sense
Except Java doesn't have "pass" by reference.

Sounds like somebody hasn't learned the power of printf.

>C# (and presumably .NET)
Just use Java and Spring you fucking faggot

>needing to print anything to test
Hi, first year student.