Cause of problem
Gets () is no longer supported by the C + + compiler of the submission platform,
Solution:
Method 1: use C language instead
However, the C speech compiler is not affected. Change the header file to C language format and use the C speech compiler to pass.
Method 2: use cin.getline instead
/* Read a line (can contain spaces) until the end of the newline character
/* Store the first num-1 characters in the array a and end with the character c */
cin.getline(a, num, c);
be careful:
You can also pass in the third parameter C, which ends with ‘\0’ by default
If num is greater than the number of characters read in, it is directly stored in the whole line of string, and then the end of character c is added at the end
Similar Posts:
- [Solved] Java Call Error: java.lang.IllegalArgumentException: wrong number of arguments
- 6. Zigzag conversion
- Python_:TypeError: write() argument must be str, not int
- [Solved] Python Error: UnicodeDecodeError: ‘gb2312’ codec can’t decode byte 0xa4 in position… : illegal multibyte sequence
- Transcoding of system.web.httputility.urlencode in C #
- [Solved] JSON check syntax error: json.decoder.JSONDecodeError: Invalid control character at: line 1 column
- error: ‘to_string’ was not declared in this scope
- Python uses xlwt length limit to report errors
- Python: json:json.decoder.JSONDecodeError: Invalid control character at: line 2 column 18 (char 19)