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.
Login
Login
OnlineGDB Q&A
Questions
Unanswered
Tags
Ask a Question
Ask a Question
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?
Your answer
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
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])
{
}
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
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.
...