Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Working on C + + in a VS 2 0 2 2 environment and getting warning in the code below. warning C 4 9 9
Working on C in a VS environment and getting warning in the code below.
warning C: strcpy: This function or variable may be unsafe. Consider using strcpys instead. To disable deprecation.
warning C: 'strtok': This function or variable may be unsafe. Consider using strtoks instead. To disable deprecation, use CRTSECURENOWARNINGS. See online help for details.
warning C: 'strcat': This function or variable may be unsafe. Consider using strcats instead. To disable deprecation, use CRTSECURENOWARNINGS. See online help for details.
#include "SortStrings.h
void ReorderAlphabeticalconst char const inString, char const outString
sizet len strleninString;
char buff charcalloclen sizeofchar;
char buff buff len ;
strcpybuff inString;
char token strtokbuff;
std::vector tokenList;
sizet i ;
while token
tokenListi token;
i;
token strtokNULL;
sizet size i;
i ;
for i ; i size ; i
for sizet j ; j size i; j
if strcmptokenListj tokenListj
char tmp tokenListj;
tokenListj tokenListj ;
tokenListj tmp;
for i ; i size; i
printfs
tokenListi;
strcatbuff tokenListi;
if i size
strcatbuff;
strcpyoutString buff;
freebuff;
void ReorderWordLengthconst char const inString, char const outString
sizet len strleninString;
char buff charcalloclen sizeofchar;
char buff buff len ;
strcpybuff inString;
char token strtokbuff;
std::vector tokenList;
sizet i ;
while token
tokenListi token;
i;
token strtokNULL;
sizet size i;
i ;
for i ; i size ; i
for sizet j ; j size i; j
if
strlentokenListj strlentokenListj
strlentokenListj strlentokenListj && strcmptokenListj tokenListj
char tmp tokenListj;
tokenListj tokenListj ;
tokenListj tmp;
for i ; i size; i
printfs
tokenListi;
strcatbuff tokenListi;
if i size
strcatbuff;
strcpyoutString buff;
freebuff;
End of File
I think I need to change strcpy strtok, and strcat to strcpys strtoks and strcats Please change it
Please do not change the code structure or warning suppress.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started