Thread: stdio.h vs iostream.h

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    2

    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?
    Last edited by Hiroyuki; 03-13-2002 at 08:48 PM.

  2. #2
    Registered User Dohojar's Avatar
    Join Date
    Feb 2002
    Posts
    115

    Talking

    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.
    Dohojar Moajbuj
    Time is the greatest teacher, too bad it kills all its students

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >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
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. error: stdio.h: No such file or directory
    By MindLess in forum C Programming
    Replies: 9
    Last Post: 12-20-2007, 08:11 AM
  2. stdio.h and iostream.h
    By kcfung in forum C++ Programming
    Replies: 5
    Last Post: 10-25-2006, 02:53 AM
  3. stdio.h
    By Vertex34 in forum C Programming
    Replies: 2
    Last Post: 07-12-2004, 10:18 AM
  4. error in -stdio.h __VALIST
    By JaWiB in forum C++ Programming
    Replies: 3
    Last Post: 09-20-2003, 12:22 PM
  5. Modifying stdio.h
    By Spectrum48k in forum C Programming
    Replies: 10
    Last Post: 05-29-2002, 08:30 AM