-
stdio.h vs iostream.h
Besides syntax what is the difference functionaly of the stdio.h( printf and scanf) vs the iostream.h (cout and cin) commands?
I'm taking a C course right now(I've taken very very intro C++ class before) and I cant stand these printf/scanf statements. I like the cout/cin better.
Take the following code example:
scanf("%i",&X);
printf("The number you entered was %i", X);
vs
cin>>X;
cout<<"The number you entered was"<<x;
maybe it's just me but I like the ladder better. It seems much eaiser and less prone to typing mistakes.
If C++ is a better C why even bother with the 30 year old C language?
-
Well the way I see it... I like cin and cout better as well. I program in C/C++ and I find cin&cout easier to work with, especially once you learn how to overload the insertion and extraction operators.
As for why bother learning C in the first place. It is a good way to learn C++ for starters. If you have a good foundation in C, then C++ isn't really that hard of a jump as opposed to going in blind. Also there is still a lot of C code still in use and will be for sometime to come I think. C is a relatively small but extreamly powerful language.
I like using both but overall I find C++ more organized than C.
That's my opion in any case.
-
>If C++ is a better C why even bother with the 30 year old C language?
Neither language is better than the other, but consider that despite the fact that C is so old, most of the programs used today were written in C. Age doesn't mean a lack of power and flexibility.
-Prelude