Home c++ ID not found / ID not defined

ID not found / ID not defined [duplicate]




There is a code on the vizhla (not mine, which vizhla was used is unknown). I’m using the 19th. The compiler swears at gets:

identifier "gets" is undefined
gets: id not found


# include & lt; cstdlib & gt;
#include & lt; iostream & gt;
#include & lt; cstring & gt;
#include & lt; cstdio & gt;
using namespace std;
int main (int argc, char const * argv [])
  char in_string [500]; // string array for input
  cout & lt; & lt; "Vvod stroki" & lt; & lt; endl;
  gets (in_string); //
  char symbol = '!';
  for (int i = 0; i & lt; strlen (in_string); i ++) {
    if (i == 1) in_string [i] = symbol;
    if (in_string [i] == '' and in_string [i + 2]! = '') {// if the i-th character is not a space, and the previous one is a space, then this is the first character in the word
      in_string [i + 2] = symbol;
  cout & lt; & lt; in_string & lt; & lt; endl;
  return 0;

How can I fix this?

Answer 1, authority 100%

There is no gets in the standard C and C++ libraries for a long time. That’s why the compiler swears.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions