Get one character from cin and store it in s[81]. Repeat this until get() fails or the character is a newline.
This seems to consume content from the input stream until EOF, endline, or some error is encountered. There is no clear reason to store it into s[81], as any char variable could be used. s[79] (or some earlier element) is '\0', and s[80] is never used. Besides, there are more than one way to flush the buffer.
toupper() takes a char and returns a char. The return value is either the input or uppercase version of it.
The return value is assigned to element in the destin array.
The value that is returned from
destin[i]=toupper(s[i])
is the same value as the toupper returns. It is essentially an integer and integers can convert to bool. If the char is '\0', the integer is 0, and the bool is
false
. Therefore, when the loop reaches c-string terminator, terminator is copied to the destin, and the loop terminates.
1 2 3 4 5 6 7 8 9 10
|
for(i=0;destin[i]=toupper(s[i]);i++);
// is equivalent to
int i=0;
do {
destin[i] = toupper( s[i] );
bool continue = ( '\0' != s[i] );
++i;
} while ( continue );
|