0

void

#include<iostream.h> void read (int x[],int y); void print(int w[],int p); main() { int z[5]; read (z,5); print(z,5); } void read (int x[],int y) { for (int i=0;i<y;i++) {cout<<"x["<<i<<"]="; cin>>x[i]; }} void print (int w[],int p) { for( int j=0;j<p;j++) cout<<w[i]<<" "; }

13th Apr 2017, 2:54 PM
ahmad alqaisi
ahmad alqaisi - avatar
3 Respuestas
+ 23
Corrected code: #include<iostream> // 1st mistake using namespace std; // you missed this void read (int x[],int y); void print(int w[],int p); main() { int z[5]; read (z,5); print(z,5); } void read (int x[],int y) { for (int i=0; i<y; i++) { cout<<"x["<<i<<"]="; cin>>x[i]; } } void print (int w[],int p) { for( int j=0; j<p; j++) cout<<w[j]<<" "; // you used i instead of j }
13th Apr 2017, 3:04 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 1
thank shamima 👍
13th Apr 2017, 3:24 PM
ahmad alqaisi
ahmad alqaisi - avatar
0
where is wrong
13th Apr 2017, 2:55 PM
ahmad alqaisi
ahmad alqaisi - avatar