There is two files one is .cpp file another is .h file , header file
This class is present in .h file
class DecodeTheCode
{
public:
char* decodeCode(char* encodedString);
};
now software which i am using asks
•Implement your logic in function char* decodeCode(char* encodedString)
but i have declared
const char* decodeCode(const char* encodedString)
{
const char* decodedString = "";
const char* a = encodedString;
char store[10000];
for(int j=0;j<strlen(a);j++)
{
if (isdigit(a[j]) || a[j] == '#')
continue;
else return "";
}
int i = 0,k=0;
while (i < strlen(a))
{
if (a[i] == '#') {i++; continue;}
else if(a[i] == a[i+1] && a[i+1] == a[i+2] && a[i+2] == a[i+3])
{
store[k++] = four(a[i]);
i += 4;
}
else if (a[i] == a[i+1] && a[i+1] == a[i+2])
{
store[k++] = three(a[i]);
i += 3;
}
else if (a[i] == a[i+1])
{
store[k++] = two(a[i]);
i += 2;
}
else
{
store[k++] = one(a[i]);
i++;
}
}
store[k]='\0';
decodedString=store; // line number 103
return decodedString;
}
in .cpp file
now the software is showing
Error(s) encountered:
C:/Users/ADMINI~1/AppData/Loca/Temp/cco5baaa.o(.text+0x18f):TestDecodeTheCode.cpp:undefined reference to
DecodeTheCode::decodeCode(char*)'
C:/Users/ADMINI~1/AppData/Local/Temp/cco5baaa.o(.text+0x1a4):TestDecodeTheCode.cpp: undefined reference to `DecodeTheCode::decodeCode(char*)'
C:/Users/ADMINI~1/AppData/Local/Temp/cco5baaa.o(.text+0x24d):TestDecodeTheCode.cpp: undefined reference to `DecodeTheCode::decodeCode(char*)'
C:/Users/ADMINI~1/AppData/Local/Temp/cco5baaa.o(.text+0x262):TestDecodeTheCode.cpp: undefined reference to `DecodeTheCode::decodeCode(char*)'
C:/Users/ADMINI~1/AppData/Local/Temp/cco5baaa.o(.text+0x30b):TestDecodeTheCode.cpp: undefined reference to `DecodeTheCode::decodeCode(char*)'
C:/Users/ADMINI~1/AppData/Local/Temp/cco5baaa.o(.text+0x320):TestDecodeTheCode.cpp: more undefined references to `DecodeTheCode::decodeCode(char*)' follow
collect2: ld returned 1 exit status
/decodethecode/decodethecode.c: In function `char* decodeCode(const char*)':
/decodethecode/decodethecode.c:103: error: invalid conversion from `const char*' to `char*'
i am using const char* decodeCode(const char* encodedString) in place of char* decodeCode(char* encodedString) because otherwise i gets deprecated conversion from string constant to ‘char*’</p>
Have you any idea how I could fix it? If so, please write it down clearly (I am newbie...).