- 1
Вопрос о массиве из, к примеру, 7 значений.
если 5 из них объявить, а вызвать шестой, то он будет равен 0, а если вызвать седьмой, то это будет случайное число... почему?
12 Réponses
+ 10
#include <iostream>
using namespace std;
int main(){
int a[5] = {1,2,3,4};
cout << a[4] << endl;//0
int b[2] = {1,2};
cout << b[3];//will be some random number . Ah ha as I said [7] is unsigned value. *REPEAT at unsigned value*. so It generate random mumber
}
+ 9
If I guess
[7] is the unassigned value
and seed (random seed number in random lesson of sololearn) is unassigned variable type too
I mean seed is unassigned value
I think that's the reason
Please be in english :( I'm confused
+ 9
Ha ha I try it,ya
That stuff can create random more faster in c++
*Record this trick*
+ 9
Nvm My english is worse than you
+ 8
Mmm.... Where is my random source file....?
Phewww
That file can explain to you uh lot
+ 6
random number??? what???
0
случайное, но постоянно одно и тоже
0
попробуйте сами
0
sorry)
0
my eng very bad
0
#include <iostream>
using namespace std;
int main()
{
int b[7] = {11, 45, 62, 70, 88};
cout << b[0] << endl;
// Outputs 11
cout<< b[3] << endl;
// Outputs 70
cout<< b[6] << endl;
// Outputs 0
cout<< b[7] << endl;
// Outputs Random
return 0;
}
- 1
but number 7 , how in space, i dont wrote she's in code