Giúp mình giải bài tập C++ này với ạ, phần “using strcpy”. Cảm ơn mọi người
Implement a function to copy a string:
void copyString(char *input, int offset, int length, bool invert, char *output, int output_offset)
- input: input string
- offset: starting position for copy
- length: length of substring to be copied
- invert: invert the result
- output: output string
- output_offset: the beginning of copied position of output
for example:
st = “Hello world” st2 = “My name is C++” copyString(st, 6, 5, true, st2, 11) à st2 = “My name is dlr”;
Implement this function in 3 ways:
- using memcpy
- using strcpy