What is wring with this one? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is wring with this one?

Hibrish number https://code.sololearn.com/c3Y0MCj9ugFM/?ref=app

21st Dec 2018, 12:10 PM
TahaNM
TahaNM - avatar
5 Answers
+ 3
while(R =! 0) { // R != 0 int a=0; // Local to the while body -- You can't specify the size of the array as `int Arr[a];` DC *= 10; R = (R-(IP%DC))*10/DC; a++; // has no effect } corrected as int a = 0; // Now, it's accessable for `int Arr[a];` while(R != 0) { DC *= 10; R = (R - (IP % DC)) * 10 / DC; a++; } ~~~~~~ int Arr[a]; // Just like the previous excercise, should be allocated dynamically as int *Arr = new int[a]; //... delete[] Arr; ~~~~~~~~ There are some other syntax errors that you should take care of.
21st Dec 2018, 2:03 PM
Babak
Babak - avatar
+ 3
Sooo, now it's the best time to bridge the gap in your programming knowledge! http://www.cplusplus.com/doc/tutorial/dynamic/
21st Dec 2018, 3:13 PM
Babak
Babak - avatar
+ 2
I used 15_20 lines just to use static memory('cause I've forgot dynamic memory๐Ÿ˜…)
21st Dec 2018, 3:05 PM
TahaNM
TahaNM - avatar
+ 2
Tnx๐Ÿ˜๐Ÿ˜๐Ÿ˜
21st Dec 2018, 3:15 PM
TahaNM
TahaNM - avatar
21st Dec 2018, 12:18 PM
TahaNM
TahaNM - avatar