i'm having trouble getting the right output: it should be 3LU$CH
#include<iostream.h>
#include<string.h>
void main()
{
int index(char *,char);
char line[30]="LUNCH";
cout<<index(line, 'N')<<" "<<line<<endl;
}
this function will replace the 1st occurance of ch by a dollar sign and return teh posiiton where the occurrence is found. It returns a zero value if ch is not found.
int index(char*s, char ch)
{
******this is the part that needs to be done. I used the strncat function but it didnt work******
}
please provide some guidance and i'd b xtreemly grateful to you.thanx.