Hi all
I wrote this code to convert the word to pig latin and i got these errors
Code:
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char first[20] , last[20] , first1[20] , last1[20];
cout <<"Enter your name\n";
cin >> first >> last;
for(int i=0 ; i<strlen(first);i++)
first[i] = tolower(first[i]);
for ( i=0 ; i<strlen(last) ; i++)
last[i] = tolower(last[i]);
if(first[0]=='a' || first[0] == 'e' || first[0]=='i' || first[0] == 'o' || first[0]=='u')
strcat(first , "way");
else
{
int j=0;
for(i=1 ; i <= strlen(first) ; i++)
{
first [j] = first[i];
j++;
}
strcat (first1 , first[0]);
strcat (first1 , "ay");
}
if(last[0]=='a' || last[0] == 'e' || last[0]=='i' || last[0] == 'o' || last[0]=='u')
strcat(last , "way");
else
{
int j=0;
for(i=1 ; i <= strlen(last) ; i++)
{
last [j] = last[i];
j++;
}
strcat (last1 , last[0]);
strcat (last1 , "ay");
}
first[0]=toupper(first[0]);
return 0;
}
The errors here
Code:
First error :(error C2664: 'strcat' : cannot convert parameter 2 from 'char' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast)
second errors:: error C2664: 'strcat' : cannot convert parameter 2 from 'char' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
same first error
how can i fix it.