amigos estou tentando fazer uma função do tipo replace em c++ porem sempre da erro vejam abaixo
#include
#include
int main(){
char nome[255];
char saida[255];
char pergunta[] = "Eu *, vou passar de ano em algoritimo";
cout << "Diga seu nome:\n";
cin >> nome;
for(int i = 0 ; i < strlen(nome) ; i ++){
(pergunta[i] != '*')? strcat(saida,pergunta[i]) : strcat(saida,nome);
}
cout << "\n" << saida ;
return(0);
}
olha o erro que me da
[pablo@localhost pablo]$ g++ teste.cpp -o teste
In file included from /usr/include/c++/3.2/backward/iostream.h:31,
from teste.cpp:1:
/usr/include/c++/3.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the header for the header for C++ includes, or instead of the deprecated header . To disable this warning use -Wno-deprecated.
teste.cpp: In function `int main()':
teste.cpp:17: invalid conversion from `char' to `const char*'
[pablo@localhost pablo]$
ou seja pq essa meleca não deixa eu concatenar
(pergunta[i] != '*')? strcat(saida,pergunta[i]) : strcat(saida,nome);
aqui ele??? como fazer isso?
resumo da funcao
replace(char, paramentro, saida)
passo a palavra pablo***henrique***, paramentro passo *, saida passo |||
ele retorna
pablo|||henrique|||