void | SoloLearn: Learn to code for FREE!

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]<<" "; }

4/13/2017 2:54:24 PM

ahmad alqaisi

3 Answers

New Answer

+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 }

+1

thank shamima 👍

0

where is wrong