Anonymous
there may be students who are studying computer science in university. and i am asking why most universities teach c++ than java. Because i am following most curriculums of universities and they only plan to teach c++
olli
there may be students who are studying computer science in university. and i am asking why most universities teach c++ than java. Because i am following most curriculums of universities and they only plan to teach c++
This highly depends on the university. At my University Java is the primary language being used. Although we had to use wide range of languages such as c++, c, Ada, Haskell, Scala, maybe VHDL and Prolog The choice of the language can depend either on industrial demands or research projects.
Anulekh
Can anyone please tell me what did i do wrong here... I'm supposed to get the values of y1,y2....as output...but it shows up as 0
Anulekh
Mat
Store pi value in a variable, please
Mat
Arrays start at 0 here
Mat
Have you done a Ctrl+c,Ctrl+v here?
Anulekh
Yeah
Mat
Write your own code, don't do that
Mat
And try to understand what's going on for every step
Anulekh
I didn't copy the code from outside source...what i copied is part of the code of my program from one place to other
Anulekh
Sorry to bother you guys... I just sorted it out...inside the loop i misstyped y[i] instead of y[j].....
Anulekh
Thanks for the response
Mat
Oh, didn't notice
Mat
Try to clean a bit all that mess
Mat
clean as make it clearer
Anulekh
How to replace value of pi?
Rajinikanth
You can use #define header file
Mat
How to replace value of pi?
const double pi {3.14...}; THAT'S CPP
Mat
Try to initialize variables
Mat
int something {}; THAT'S CPP
Mat
You avoid undefined behaviour this way
BinaryByter
const double pi {3.14...}; THAT'S CPP
Theres a stdlib function that gives you the best amount of precision depending on tte type of fpoint you ask it for, iirc
BinaryByter
But this is just a wild guess
Mat
int something {}; THAT'S CPP
That's like int something = 0; but better afaik And int a {3}; is equivalent to int a = 3; but better THAT'S CPP
BinaryByter
You can see it like passing the int as a constructor to int
BinaryByter
Its not better, its different
olli
BTW c++ does not define PI as a constant
BinaryByter
You should use {} instead of () for class instantation so as to avoid MVP
BinaryByter
BTW c++ does not define PI as a constant
If you use amd, pi = 3,2138
BinaryByter
:P
olli
There was a proposal for C++20 to add several math constants though
Mat
Fuck!
Mat
He was using C
BinaryByter
BinaryByter
Why?
how would you define tho consts? Censtexpr? Const? #define?
BinaryByter
Idk
BinaryByter
Sensible
olli
Depends on the language of course. I think adding M_PI as preprocessor macro to math.h and cmath would probably be sufficient for most cases
BinaryByter
Well maybe it isnt that outlandish
Ludovic 'Archivist'
There were stuff like plank constant, pi, gravitational constant etc etc
BinaryByter
I dont put my dick's size into my programs
Ludovic 'Archivist'
BinaryByter
Anyone doing science
Lmao my dick is in science
BinaryByter
I feel like i scared him with my inane shitpostisg
BinaryByter
What are narrowing conversions?
olli
int i = 3.9;
BinaryByter
Like. Float to int?
Mat
Yes
BinaryByter
Like. Float to int?
My compiler does that without. Though i have fulr warnings enabled
Mat
It says that you're doing something not wrong but not good
BinaryByter
Imho the braces are ugly
Ludovic 'Archivist'
When using braces your compiler warns you about narrowing conversions
It always does when narrowing as for me, which is normal
BinaryByter
You dudes use clang. Eww
Ludovic 'Archivist'
Like, when doing int a = some_long_int;
olli
"warn" in terms of error
BinaryByter
You should enable the warnings=error tag
Ludovic 'Archivist'
A narrowing issue is an error
olli
Although the standard does not prohibit this behavior.
olli
In contrast, using brace-initializers the standard does
Ludovic 'Archivist'
Ludovic 'Archivist'
olli
But I don't care whether it's in respect to C or something else, it is still technically allowed (http://eel.is/c++draft/conv#fpint-1)
olli
exactly, so why not use {} which prohibits this behavior?
BinaryByter
Because its ugly, redundant, and unclear of intent
BinaryByter
The more i look into modern cpp the more i recognize php in it
BinaryByter
Whicd asaddens me
Ludovic 'Archivist'
exactly, so why not use {} which prohibits this behavior?
I prefer using {} as for me, it is a good habit to get to avoid mvp issues