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