Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Why an error in while (cin >> #variablename#)?

0 votes
asked Mar 17, 2020 by Nicola Zucchia (120 points)
Terminal gives me an error in

while (cin>>value) {.

It says there is no matching for ">> operand".

How to solve it?

1 Answer

0 votes
answered Mar 20, 2020 by sunny (140 points)
You must be using %,& operator. In c++ you can directly use cin>>operand and variable name.

For e.g.

cin>>a,b,c;
commented Mar 23, 2020 by Nicola Zucchia (120 points)
I am using c++.
I defined a variable in main function, "value".
I defined a vector where the values the user types are gathered. Now, to have the user insert values I use a while cycle, like this:
while (cin>>value) {
  vector:push_back(value);
}
Anyway, the debugger says there is an error in cin>>value operand... Can't understand why, the exaample you exposed is exactly the situation where I get told there is an error. :(
commented Mar 25, 2020 by sunny (140 points)
Vectors in C++ are sequence containers representing arrays that can change in size.
for e.g.
  while(cin >> value[10])
  {
    
  }
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...