+ 1

Doubt

Why do we write #include<iostream>. I mean why don't Developers of c++ wrote it by default?

28th Jan 2018, 9:10 PM
Chandan Dhillon
Chandan Dhillon - avatar
5 Réponses
+ 5
>> Why is it necessary to write #include<iostream>? It's not. Actually, in most real cpp files that header is not included. You most likely are using that header for simple input/output aka cin and cout. Your program will do perfectly fine without that include, if you don't use that I/O. >> Why don't developers of c++ wrote it by default? Because it's not a feature every cpp file needs included, and because of cpp motto "you don't pay for what you don't use".
28th Jan 2018, 9:22 PM
deFault
+ 3
<iostream> is the source package for input and output, etc. Without it, you wouldn't be able to do those things. The second question is a question for the developers. 👍😂
28th Jan 2018, 9:12 PM
Dread
Dread - avatar
+ 3
Iostream is used for input and output. In same case, there is no need of this. suppose, you use c++ with opencv. most of the times, you don't need to add iostream header.
28th Jan 2018, 9:47 PM
Vijay
Vijay - avatar
+ 2
You are confusing me. Your question asks why it is necessary to write it. If you didn't mean to ask that, please edit? 😂
28th Jan 2018, 9:17 PM
Dread
Dread - avatar
0
No I meant is it related memory or something like that
28th Jan 2018, 9:14 PM
Chandan Dhillon
Chandan Dhillon - avatar