Thread: (printf VS cout) and (including libraries)

  1. #1
    \cFallen
    Guest

    Question (printf VS cout) and (including libraries)

    Hello,

    I wondered if printf and cout did the same thing, so I build 4 "hello world" programs.
    - In the first one, I used printf and included <stdio.h>. It had about 4400 bytes.
    - In the second one, I did the same as the first, but included <iostream.h> as well. It had about 4600 bytes.
    - In the third one, I used cout << "Hello World\n" and included <iostream.h>. It had about 4800 bytes.
    - In the last one, I used cout << "Hello World" << endl and included <iostream.h>. it had about 5000 bytes.

    My question is: Are this differences significant in a large program?


    Thanks!

  2. #2
    Registered User
    Join Date
    Nov 2002
    Posts
    1,109
    I don't think so, but cout is just c++ i believe.

  3. #3
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078
    It's entirely implementation dependant. Don't pay attention to the numbers.

  4. #4
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361

Popular pages Recent additions subscribe to a feed