1

So I'm at university second semester and we are learning Data Structures. Back in first semester we used to learn C, and now we are moving on C++ (I guess due to the OOP, which allows us to implement those data structures).

But apparently we are still including C's libraries instead of C++'s. I'm aware that stdio is for C and iostream is for C++. I'm wondering why use stdio instead of iostream? is cout << bad/slow/etc?

Kyojin
  • 157
  • 2
  • 12

1 Answers1

7

It's because your "professor" is used to it, and is teaching obsolete/antiquated techniques.

It won't do you much good in the real world.

This is even more apparent by your use of the name "iostream.h" — this suggests you're being taught on Turbo C++ using a DOS emulator, as if it's still 1991. It's not still 1991. In real C++ it's just "iostream".

The world moved on some twenty years ago.

Well done for asking, though. So so so so so so so so many don't. :(

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
  • sorry, i didn't want to mislead. My mistake. I meant only But even so, for me, what should I use instead of iostream or stdio? – Kyojin Feb 15 '16 at 17:17
  • What's wrong with Turbo C++? It works just like any other IDE would work. – lost_in_the_source Feb 15 '16 at 17:30
  • 4
    @stackptr: Other IDEs do not require a _DOS emulator_ to run. They also do not bundle a version of C++ that predates standardisation by almost eight years, and the most recent version by over _twenty_. So, no, it doesn't work just like any other IDE. – Lightness Races in Orbit Feb 15 '16 at 17:36
  • @PreferenceBean if it supports C89, its all good. What's the problem with using a DOS emulator? Most programmers write code in vi/emacs/ex/notepad and compile from the command line. – lost_in_the_source Feb 15 '16 at 17:41
  • @stackptr: Hehe you're funny sweetie :) – Lightness Races in Orbit Feb 15 '16 at 17:42
  • @PreferenceBean How am I funny? – lost_in_the_source Feb 15 '16 at 17:44
  • @stackptr: Aww haha! – Lightness Races in Orbit Feb 15 '16 at 17:45
  • 2
    @stackptr Honestly not sure if you are being sarcastic, trolling, or actually mean any of that. – user4581301 Feb 15 '16 at 19:12
  • Sarcastic about @user4581301. I'm not trolling. – lost_in_the_source Feb 15 '16 at 19:17
  • 2
    @stackptr The IDE part of Turbo C++ is not the problem. If you prefer to use the IDE, then use it. Maybe you grew up programming with it, and can't read code that isn't yellow-on-blue. Different strokes for different folks, and all that. The *real* problem with Turbo C++ is the *compiler* that it bundles along with the IDE. It is horribly out of date, lacks full support for even the original ISO-standardized C++ (informally known as C++98), cannot produce native Win32 executables, and entrenches bad programming practices due to its anachronisms. Use any IDE you want, but get a new compiler. – Cody Gray - on strike Feb 16 '16 at 05:17
  • If that's what you mean then you are right @CodyGray. I don't use Turbo C++, nor have I ever used it; I just started this whole argument because I didn't know its compiler was so bad. – lost_in_the_source Feb 16 '16 at 13:57
  • Then why would you make such a firm assertion as _"It works just like any other IDE would work"_ :facepalm: – Lightness Races in Orbit Feb 16 '16 at 16:19
  • 2
    @stackptr: FWIW, 15 years in the business, and while I *started* with IDE's, today I write my code in Vim and compile from the command line. I consider that a definite improvement. ;-) – DevSolar May 09 '16 at 14:35