Top "Cin" questions

std::cin is the global stream object provided by the C++ standard library for reading from the standard input stream.

Correct way to use cin.fail()

What is the correct way to use cin.fail();? I am making a program where you need to input something. …

c++ cin
Difference between cin and cin.get() for char array

I have these 2 codes: char a[256]; cin>>a; cout<<a; and char a[256]; cin.get(a,256);…

c++ arrays string namespaces cin
std::cin.getline( ) vs. std::cin

When should std::cin.getline() be used? What does it differ from std::cin?

c++ getline cin
C++ round a double up to 2 decimal places

I am having trouble rounding a GPA double to 2 decimal places. (ex of a GPA needed to be rounded: 3.67924) I …

c++ rounding cin ceil
if (cin >> x) - Why can you use that condition?

I have been using "Accelerated C++" to learn C++ over the summer, and there's a concept which I don't seem …

c++ variables if-statement cin
cin >> "no operator matches these operands"

I've been working on a C++ project in visual studio 2012 console mode and I keep getting this strange persistent error …

c++ cin
How to signify no more input for string ss in the loop while (cin >> ss)

I used "cin" to read words from input stream, which like int main( ){ string word; while (cin >> word){ //…

c++ file-io cin eof
Why isn't cin >> string working with Visual C++ 2010?

#include <iostream> using namespace std; int main() { string s; cin >> s; cout << "Hello World!"; } …

c++ string cin
difference between cin.get() and cin.getline()

I am new to programming, and I have some questions on get() and getline() functions in C++. My understanding for …

c++ get cin getline
C++ cin char read symbol-by-symbol

I need to read symbol-by-symbol. But I don't know how to read until end of input. As exemple test system …

c++ stream char cin