0
tell me a mistake
#include <iostream> using namespace std; int main() { int b[2]={1,3}; cout << b<<endl; return 0; }
7 Respostas
+ 5
cout << b[0] <<endl;
cout << b[1] <<endl;
+ 2
Zen is right.
Or you can use a loop if you want to make the code easier to scale for larger arrays.
+ 1
you're right! thank you so much
0
Thanks Zen!!
0
it will print 1 on the screen.
if u want all the elements then u should use loop statements or index no:
0
#include <iostream>
using namespace std;
int main() {
int b[2]={1,3};
for (int x = 0 ; x < 2 ; x++){
cout << b[x]<<endl;
}
return 0;
}
- 5
remove "="
int b [2]{1,3};