./a.out < inp1 |
|
|
cin>>x;
, where x could be a char, int, float or string). The bad thing about >> is that it stops reading at ' ' character, while getline stops at '\n' only. That means that if you have written several words >> will only read the first of them.
You can also use >> operator for input |