Can I use cin in a loop ?if yes how? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

Can I use cin in a loop ?if yes how?

22nd May 2019, 12:30 PM
//(AnOnYmOuS);
9 Answers
+ 8
Carmine 🇮🇹 Still cin is working only once The same value is used again and again
22nd May 2019, 2:19 PM
//(AnOnYmOuS);
+ 8
Carmine 🇮🇹 This is what happens when I enter wrong value https://drive.google.com/file/d/1or0Dr08xEjTx8u4EHRrgBlpSvgBpwHSK/view?usp=drivesdk I want a program which asks for input again not one which loops forever on entering a wrong value
22nd May 2019, 2:45 PM
//(AnOnYmOuS);
+ 7
Carmine 🇮🇹 What about if and else??
22nd May 2019, 1:52 PM
//(AnOnYmOuS);
+ 7
Carmine 🇮🇹 Hey I want to use cin twice
22nd May 2019, 2:01 PM
//(AnOnYmOuS);
22nd May 2019, 2:06 PM
//(AnOnYmOuS);
+ 5
I want to make a code which makes the user input a value and then checks the value and if the value is correct then again asks for input to continue
22nd May 2019, 12:34 PM
//(AnOnYmOuS);
+ 2
Can you explain what exactly you want to do?
22nd May 2019, 12:32 PM
HonFu
HonFu - avatar
+ 1
yes, you use cin command normally after providing the condition to loop
23rd May 2019, 1:42 AM
Ameer Wajid Ali
Ameer Wajid Ali - avatar
0
we use cin as we wish as we want....it depends on function perfomance.
23rd May 2019, 8:04 AM
MUHAMMAD UMAIR YOUSAF
MUHAMMAD UMAIR YOUSAF - avatar