One year of programming. | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 4

One year of programming.

i didn't feel like just one year passed. i learned more from SL than from highschool. Here are lots of programming languages instead of only C++ . In one year we learned only 2 modules on C++. i've discovered some things that we didn't learn... The computer can't understand the randomness and infinity. The rand() function is taken by time. And using for example: while 1>0 n=n+1 end puts n will not print infinity (obviously), it will print "Time limit excideed". Check out the random code!

10th Sep 2017, 9:02 PM
Nicolae Ionescu
Nicolae Ionescu - avatar
4 ответов
+ 7
Keep going and don't be afraid to use other resources and improve your knowledges. In Javascript the randomness is often managed by browser and can be variable to what browser you're using.
10th Sep 2017, 9:38 PM
Maz
Maz - avatar
10th Sep 2017, 9:04 PM
Nicolae Ionescu
Nicolae Ionescu - avatar
+ 1
Omg 512/512 characters!
10th Sep 2017, 9:03 PM
Nicolae Ionescu
Nicolae Ionescu - avatar
+ 1
Well actually while 1>0 n=n+1 end puts n Will only print "Time limit exceeded" on sololearn because it is an online compiler, it only gives you a limited time to run your code. So it is not your program that prints it, sololearn does it, run it on your own pc and it will be an infinite loop ( without printing stuff ). Also rand() isn't taken by time, rand ( in C++ at least ) is a linear congruential generator and works something like this: namespace Random { unsigned seed = 0; void srand(unsigned seed_) { seed = seed_; } int rand() { seed = (214013 * seed + 2531011) % (1 << 31); return seed / (1 << 16); } } See, no time involved. srand( time(0) ) doesn't make the algorithm time based. Well, gl on the rest of your journey. :D
10th Sep 2017, 9:43 PM
Dennis
Dennis - avatar