include# Include "conio.h" # include "string.h" # include # Include "stdio.h" using namespace std; void main () {system ("cls"); nameStr string, int len; abc characters [50] $ char (5), / / change the default value of $ to <new symbols <court "what is your name?" getline (Cin, nameStr) court <
abc = namestr; // how do i do this in Visual C + + 2010 y Borland Turbo C ++???????? len = strlen ("nameStr"); court <<" n" <
char ch;
cout<<"nenter a character que desea reemplazar a su nombre ";> cin> ch; for (int i = 0; i <50; i + +) {if (abc [i] == ch) abc [i] = $;} court <
_getch();
}
There are multiple problems. 1) The concepts are mixing C with C + +, you can not assign a string data type to an array of characters. 2) You can use namestr.replace to achieve what you are trying to do with the loop 3) Instead of variable string nameStr why you can not take input directly to the array of characters abc? Studying this ———————– ——————– # Include # Include "conio.h" # include "string.h" # include using namespace std int main () {system ("cls"); nameStr string, int len, $ char (5), / / default to change dollars into new symbols court <<"What is your name?" getline (cin, nameStr) court <
char *abc=new [Namestr.size () +1] char; [namestr.size ()] abc = 0; memcpy (namestr.c_str abc (), namestr.size ()); Len = strlen (abc) court <<" n" <
char ch; cout <<" nNo olvides incluir un personaje que desea reemplazar your name "> cin> ch; for (int i = 0; i <50; i + +) {if (abc [i] == ch) [abc i] = $;} court <
cin.get();
}
.