i am supposed to make 2 functions called find and they are supposed to find a character or string if they are similar
when i do this progam gives me weird error:
"use of search ambigious"
"first declared as class search here.
//main
#include <iostream>
#include <cstdlib>
using namespace std;
#include "strextra.h"
int main()
{
search a;
cout<<"enter max number of characters in the sentence";
int number;
cin>>number;
cout<<"enter a sentence";
char let;
char mycstring[number];
for(int i=0; i<number; i++)
{
cin>>let;
mycstring[i]=let;
}
mycstring[number]='\0';
cout<<"my string is\n"<<mycstring<<"\n";
cout<<"enter the character you are trying to find in the string above\n";
char alpha;
char lett[1];
for(int a=0; a<1; a++)
{
cin>>alpha;
lett[a]=alpha;
}
lett[1]='\0';
a.find(mycstring, lett);
}
//interface
#ifndef STREXTRA_H_INCLUDED
#define STREXTRA_H_INCLUDED
#include <iostream>
using namespace std;
class search
{
public:
int find(char mystring[],char letter[]);
int find(char mystring,string word);
};
#endif // STREXTRA_H_INCLUDED
//implementation
#include <iostream>
#include <cstdlib>
#include <cstring>
using namespace std;
#include "strextra.h"
int search::find(char mystring[],char letter[])
{
return strcspm(mystring[],letter[]);
}