0

Why we use iostream

1st May 2019, 4:51 AM
Rihan Khan
Rihan Khan - avatar
2 Respuestas
1st May 2019, 5:46 AM
Nova
Nova - avatar
+ 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
1st May 2019, 6:28 AM
Ipang