I want the following program to use lesser memory as much as possible. Any suggestions?
#include <iostream.h>
#include <conio.h>
void InputNum(void);
void SearchNum(int);
int numArray[10];
main()
{
int num;
InputNum();
cout<<"\nEnter the number to be searched:";
cin>>num;
SearchNum(num);
getch();
}
void InputNum(void)
{
for(short i=0;i<=9;i++)
{
cout<<"\nNumber "<<(i+1)<<":";
cin>>numArray[i];
}
}
void SearchNum(int n)
{
bool found = 0 ;
for(short i=0;i<=9;i++)
{
if((n == numArray[i]))
{
found=1;
break;
}
}
if (found)
{
cout<<"NUMBER FOUND!";
}
else
{
cout<<"NUMBER NOT FOUND!";
}
}