olli
but nevertheless both programs will be terminated as soon as i ==10 , so what diff does it make ?
test it, let's consider the case for i equals 9 in ++i < 10 you increment i (so it's 10) and then you compare which fails in i++ < 10 you compare which is true since 9 < 10 and then you increment so for the latter you execute the body one more time
olli
right. executing the body 1 more time increases the time complexity by a hell lot of margin..lmao
> increases the time complexity by a hell why would that be? Generally speaking you execute it n + 1 instead of n times which is still linear
Z
> increases the time complexity by a hell why would that be? Generally speaking you execute it n + 1 instead of n times which is still linear
that was a sarcasm ...i just meant to say that how does it matter if it gets executed 1 more time ? thus , I was saying earlier that i++ and ++i can be used interchangeably
Z
Umm it depends upon how many times you want to use it.
but its linear anyways ..not a big deal I guess
olli
that was a sarcasm ...i just meant to say that how does it matter if it gets executed 1 more time ? thus , I was saying earlier that i++ and ++i can be used interchangeably
your index might be out of bounds? you might dereference a NULL pointer? There are a ton of critical "off-by-one" errors
olli
eg. I'd argue that's bad although we "just ran it one more time" CVE-2001-1391 Off-by-one vulnerability in driver allows users to modify kernel memory.
olli
or this one which got rated 10/10 CVE-2003-0252 Off-by-one error allows remote attackers to cause a denial of service and possibly execute arbitrary code via requests that do not contain newlines. NIST: NVDBase Score: 10.0 HIGHVector: (AV:N/AC:L/Au:N/C:C/I:C/A:C)
Anonymous
which is pure ide for programming? bcz i searched in internet, this group, most i found is that vim, visual code, atom and most applications are all text editors
olli
which is pure ide for programming? bcz i searched in internet, this group, most i found is that vim, visual code, atom and most applications are all text editors
Visual Studio, CLion (only free for Students), Eclipse are pretty common ones. Depending on your needs, an editor such as Visual Studio Code will be enough for most people.
Anonymous
You can get a free version of any JetBrains product installing versions from Early Access Program (EAP) It's free, ultimate version, that can be used for commercial development also (student versions can't)
Anonymous
Also if you report a lot of bugs, they can give you 1-year licence for free
PaAaAria
I've written this code for solving a differential equation by Rung-kutta 2nd order method.I want to know whether it is correct or not. could anybody help me? https://hastebin.com/husoricivi.cpp
labyrinth
is there anyway to explain what on earth <type&>(type & __f) is ? in `std::function<int (int, int)> &std::function<int (int, int)>::operator=<type &>(type &__f)
labyrinth
r.h.s. of operator=
Anonymous
Hu guys my master ask me to calculate areas of circles and if the areas had 3 number differens then show those at the end how can i calc that?
Anonymous
/warn PMing
Anghelo
Gentlemen, let me ask you a question. which c / c ++ compiler recommends and which does not?
Pavel
Kanni
Get cboook
Kanni
Cppbookguide
Anonymous
Are you ok?
Kanni
Please how do I get books on c++
Kanni
Get cboook
Pinned rules said to use these commands
Kanni
/Get cboook
Anonymous
Pinned rules said to use these commands
Well The commands look different Read carefully lol
Kanni
/get cppbookguide
Pavel
/Get cboook
Too many ooo :)
Pavel
/get cbook
Kanni
Too many ooo :)
Ahhh I didn't notice.... thanks
Shlomo
Shlomo
/get cbook
Addy
/notes
Kanni
#best-book
Anonymous
/get goodcodingmentality
Anonymous
#india
King Phyte 🐍
#cpp-vscode
Anonymous
😒 m aslo new here
Anonymous
Write the following program by using the Accept Something and Return Nothing function type; #include <stdio.h> void my_function1 (int a) { int b; for (b=0; b<a; b++) printf ("Hello world! \n"); printf ("I accept something\n"); printf (" but return nothing\n"); } void main (void) { int a; printf ("Type a number : "); scanf ("%d", &a); my_function1 (a); } How to write an Algorithm?
Al
with a pen you can draw a flow chart for example
Anonymous
nohello.com
Ishikawa
Is there another way to do the following, but natively? system("sleep 0.1");
Ishikawa
i just want the program to wait for sometime before going further
Xudoyberdi
Xudoyberdi
I learned from cs50, I didn't try though😄
Ishikawa
is that in milliseconds?
Xudoyberdi
Anonymous
i just want the program to wait for sometime before going further
using namespace std::chrono_literals; std::this_thread::sleep_for(10s);
Al
no
Anonymous
Why would it be lol
Al
did you see it from questions or answers?
Ishikawa
Yes
no its not, its seconds.
Yuval
Oh God no
Ishikawa
just tried it bro, its seconds
Roshan
Oh God no
I think I should delete my joke... People are not getting it
Yuval
is that in milliseconds?
Isn't sleep in milliseconds?
Roshan
Isn't sleep in milliseconds?
There are 2 types of wait: Sleep() and sleep()
Ishikawa
i just put 115 and it kept waiting, replaced it with .0115 and now its working all fine
Yuval
Just checked , it in seconds
Al
all the google world agree... its in second
Al
but ... you know ... time is relative
Yuval
all the google world agree... its in second
Yes, It is possible to use std::chrono for time period
Yuval
And do a cast there to milliseconds