I have program that wants the user to inter an array and revers it and alos serch for some elements in the array
but I have an error C2679 binary'<<': no operater found which takes a rigth-hand operand of type 'void' ( or there is no acceptable convesion).
and I tryed alot to solve it but it dose not work :(
here is my code,
#include <iostream>
using namespace std;
const int x = 5;
int a[x];
void print();
void revers (int b[x]);
int search(int i);
void main()
{
cout<<"Enter the element of the array: \n";
for (int i = 0 ; i<x;i++)
{
cin>>a[i];
}
print ();
cout<<"\n";
search(a[x]);
}
void print ()
{
for (int j=0 ; j<x; j++)
{
cout<<a[j];
}
cout<<"The array after revers is : " << revers (a) << "\n";
}
void revers (int b[ ])
{
int k = 0;
int l = 0;
int r = x - 1;
while (l < r )
{
int k = b[l];
b[l] = b[r];
b[r] = k;
l++;
r--;
}
}
int search(int y)
{
y = 0;
int n ;
cout<<"Enter the number you are looking for : ";
cin>>n;
for (int i = 0 ; i < x ; i++)
{
if (a[i] == n)
y += 1;
}
cout<< y <<" times \n";
return y;
}