0
Why we use iostream
2 Answers
+ 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