- 1
can someone help, fill in the blanks to print all elements of the array using a for loop? int [] arr= new int [7]; ? (int k=0; k < ? ; k++){ console.writeline ( ??? [ k] );
7 Respuestas
0
int * arr=new int[7];
for (int k=0;k<7;k++){
console.writeline(arr[k]);
}
0
your code is c#, not c++.
But you could use Console::WriteLine if you are using .NET framework.
0
That's true Grame, thank you for this answer. In c++ i would write : cout<<arr[k]<<endl;
- 2
Jesus: Yours no. The asker's one. Your code is good for C++ appart from the console.writeline line.
Well, i know you could make a custom class Console, create an attribute writeline and instate the class with name console. Then you could use console.writeline.
- 2
Jesus: Even if you wrote cout << arr[k] << endl your program wont work, because you only said that arr has space for 7 integers, you never initialized the array with values and that leds to undefined behaviour.
- 2
Hhhhh
- 3
my code?