0

Someone please help me !!

int main () { int loop, number [5]; cout << “Insert 5 number” << endl; for (loop = 0; loop < 5; loop++) { cin >> number [loop]; } cout << number << endl; } Why the program not showing my 5 number that i insert ? Its show 0x22fe30

26th Jun 2019, 12:50 PM
Haziq Haris
Haziq Haris - avatar
3 RĂ©ponses
0
Because arrays are actually pointers to the memory location. To print all of it, you should use a for loop: for (let i = 0; i < 5; i++) cout << *(number + i) << endl;
26th Jun 2019, 12:57 PM
Airree
Airree - avatar
0
you have to use loop to print the results as well cause it is in array for(int loop=0; loop<5; loop++) { cout<<number[loop]<<endl; } just remove "cout<<number;" it's wrong...
26th Jun 2019, 12:59 PM
🩋FEATHER🩋
🩋FEATHER🩋 - avatar
0
thank youuu 🙂
26th Jun 2019, 1:02 PM
Haziq Haris
Haziq Haris - avatar