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++
Anonymous
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
Try to initialize variables
Mat
int something {};
THAT'S CPP
Mat
You avoid undefined behaviour this way
BinaryByter
But this is just a wild guess
Mat
BinaryByter
BinaryByter
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
BinaryByter
:P
olli
There was a proposal for C++20 to add several math constants though
Mat
Fuck!
Mat
He was using C
BinaryByter
olli
BinaryByter
Why?
how would you define tho consts? Censtexpr? Const? #define?
BinaryByter
Idk
Ludovic 'Archivist'
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
BinaryByter
I dont put my dick's size into my programs
Ludovic 'Archivist'
BinaryByter
I feel like i scared him with my inane shitpostisg
olli
BinaryByter
What are narrowing conversions?
olli
int i = 3.9;
Mat
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'
BinaryByter
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)
Ludovic 'Archivist'
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
BinaryByter