T
T
Tesla4o2018-04-28 09:31:05
C++ / C#
Tesla4o, 2018-04-28 09:31:05

How to exit string input loop in vector?

Tell me how it is possible in the setSumm() function to write the output from the input into the loop.
I'm just learning the positives.

private:
  vector<string> name;
};

void Summ::setSumm()
{
  for (int i = 0; i < SIZE_VEC; ++i)
  {
    cout << i + 1 << " - ";
    string var;
    getline(cin, var);
    name.push_back(var);
    
  }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
res2001, 2018-04-28
@res2001

break statement .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question