Any Reason for using initializer lists in the constructor ?
sto ova zadnja kad onesem 3 i 5 kaze 9 i 24 treba 9 i 25 ?
Well .. C++ is the strongest language .. ( just harder to use ) ..
you just comlicating your life with c++,use python ofc;)
Quote from: uCANseeMe on March 31, 2015, 20:44sto ova zadnja kad onesem 3 i 5 kaze 9 i 24 treba 9 i 25 ? ah y, cause I made variable a an integer, function pow returns float, so it was 24.999smth = 24 as integer.Just replace pow(a,2) with a*a
You could also be aware about casting float to int, and round that either with round() function (part of <math.h> library) or effectively do it manually by adding pow(a,2)+0.5 before cast to int (same result... in most cases) Limited float precision can be a bitch.
Quote from: cacomonster on March 31, 2015, 21:29Any Reason for using initializer lists in the constructor ?In this easy class, it is pretty much same as using regular stuff like kompleks(int a,int b){Re=a; Im=b;};But in programs where more classes are connected and some are derived from others, it can speed up process a bit, specially if there are many variables in class as far as I know. I'm not exactly sure why, but compiler probably treats them like some special type of function, not like the regular call etc.Quote from: uCANseeMe on March 31, 2015, 20:44sto ova zadnja kad onesem 3 i 5 kaze 9 i 24 treba 9 i 25 ? Neam pojma, bug, worked fine for me
Quote from: cacomonster on April 01, 2015, 23:38Well .. C++ is the strongest language .. ( just harder to use ) .. To kill a fly, you don't need to use grenade. Besides, just because c++ (or hell, asm for that matter) can run faster, doesn't mean it will in hands of unexperienced dev. Moreover, unlike with python, javascript, php, java, and a bunch of others, you can't really make a webapp with c++ can you? (hint - web stuff is trending )