In your function SamKorotkSlov() (at least here in the above code), there are no input data from the file into str[]. Why do You open the file many times and in different styles (C++, C)? Just one, then it can be re-read from the beginning. -In fact (assuming that the word is also limited by the end of the line) a single pass of reading the file line by line. Along with checking the length of a string, you can choose from it the words and store the shortest (You know, there might be several) in the array. At the end you can print them from this array. What is not clear - ask. -

For highlighted words with a minimum length, use the function SetConsoleTextAttribute. For example according to the following algorithm: remember the length of the minimal words in the text, and then printing to console the text one word at a time (do not forget about punctuation and spaces) and, if the word length is equal to the minimum, then set the text color, e.g. to red, displaying the word and then return the white color. Something like this:

@Daniel, (as I understand it Your answer) and why such a strange ...|| min == -1) to find minimum? In General, the highs-lows of the types prescribed in and int is INT_MAX. You take the unsigned min, and assigning it to -1 make it UINT_MAX. Thus, any word length (buf.length() and the first including) will be less than the initial min (and everything will work without a check for -1). -