Why we use iostream | Sololearn: Learn to code for FREE!

0

Why we use iostream

5/1/2019 4:51:51 AM

Rihan Khan

2 Answers

New Answer

+20

https://www.sololearn.com/discuss/1689816/?ref=app This may help.

+5

Easier I/O interaction IMHO, one really need to pay attention using C I/O functions, getting input using wrong input specifier for example, can make your program buggy (I've met one). It also applies for output, you may see unexpected output too, if you set incorrect specifier for the type to print. Using iostream means not as much performance, but you are spared from the details commonly required in formatting and type specification. All these details are built into the stream. int age; double height; ● iostream std::cin >> age >> height; std::cout << age << std::endl; std::cout << height << std::endl; No need to specify type of `age` or `height`. iostream manage that. ● cstdio scanf("%i %lf", &age, &height); printf("%i\n", age); printf("%lf\n", height); You must explicitly (and correctly) specify type of `age` and `height` to get I/O operation to work as expected. There should be more than this IMHO, I wrote only what I knew, which is very few. P.S. Please add C++ in Relevant Tags. Hth, cmiiw