I am new to c++ and need some help to edit the user input. For example, I ask the user to enter the module code and afterward i need to take in the user input and change it to this format < "(user entered module code).dat" >
.
.
char module [20];
char frontOfModule []= "\""; //initilize like this
char formatedModule [100];
//frontOfModule[0]='"'; this was causing the error
//when character array is used as string programmer must remember to
//add a null charecter [\0] at the end of the string
//" frontOfModule[0]='"'; " - doesnt add the null character to the end
cout << "Enter the module code: ";
cin >> module;
strcat (module,".dat\"");
strcpy (formatedModule, frontOfModule);
strcat (formatedModule, module);
cout << formatedModule;
.
.
but still task can be achived using less memory and time