Reputation: 4516
This is totally an opinion question. More for chatter.
I'm taking some c++ tests and they are littered with cin and cout's.
Do people acutally still use these. I mean I've not seen one in an actual public application ever.
The last question I answered in a test was
int c1;
cout << "Enter numbers: " << flush;
for(int n = 0; cin >> c1; ++n){
cout << c1 << endl;
}
When does this end..
The correct answer was "when a user hits ctrl+Z". Where in the heck would I press control+Z? I'm assuming in the terminal, I suppose. But honestly. I've not seen the terminal for ages and ages. And I'm sure as heck not going to attempt to program anything for it.
Are questions like this still relevant, in any of our lives?
Upvotes: 5
Views: 4160
Reputation: 2344
I use std::cin, std::cout and std::cerr daily. Systems programming lacks GUIs.
Upvotes: 0
Reputation: 1939
In my opinion, to write a complex piece of software, it is a good approach to separate the GUI from the rest, i.e., in general, the rest must be able to work even without the GUI.
In this case it can be convenient to manage I/O with cin/cout.
Upvotes: 3
Reputation: 993
I've worked on many professional applications and we've not used cin or cout on any of them, even for logging/debugging. Why? Because the stateless *printf methods work perfectly well. One thing I've learned over the years is that stateless trumps statefull for maintainability.
Upvotes: 2
Reputation: 65599
It would be more acceptable, from a language standpoint, if the answer to "when will this program end" was "when EOF is received". Just because "Control-Z" is EOF in DOS, does not mean Ctrl-Z is the right answer.
Edit Edited with comment info.
Upvotes: 1
Reputation: 111130
Do people acutally still use these. I mean I've not seen one in an actual public application ever.
Define public application. What do you think the command line tools on any *nix use? And yes, we too use them, for our SDKs (at least cout and cerr). cin
is often not the best when you have complex enough input -- you are left to write a lexer and a parser of sorts.
Upvotes: 2
Reputation: 17405
I'd rather use wcin and wcout, at least you get the Unicode stuff.
Upvotes: 2
Reputation: 405745
If you only ever write GUI or Web applications in your career you probably won't have much use for cin and cout. If you ever write anything embedded you'll change your position. You just use a different set of libraries for console apps, text-based apps, GUI apps, and Web apps.
Upvotes: 2
Reputation: 11537
Of course it's relevant.
Many automation and admin scripts on a variety of servers rely on text output/input, for example. This is especially true on *nix systems, not as much on windows now that Powershell has come about with its fancy object support.
Then there are the ones of us (a dying breed, I admit) that pretty much LIVE in the terminal. I use the terminal for about 70-80% of my work. I just find it more natural, faster and more powerful than most related GUI apps.
Upvotes: 6
Reputation: 16994
No, such questions are not very relevant, but yes, people use std::cin and std::cout all the time. Even the ones who design graphical interfaces may use cout for debugging !
Upvotes: 12
Reputation: 36577
Terminals are widely used, and will be used. The reason is that, when used skillfully, they're far more powerful than any GUIs.
Upvotes: 22
Reputation: 13696
So you want to say that you are a programmer and never used or wrote console application?
Upvotes: 6
Reputation: 303
Yes, as long as console applications exist, cout and cin will exist.
Upvotes: 9
Reputation: 421988
Yes, you might want to process or transform an input text file. It'll prove handy.
Upvotes: 4