Quantcast

Jump to content

» «
Photo

Is C better than vb

30 replies to this topic
K^2
  • K^2

    Vidi Vici Veni

  • Moderator
  • Joined: 14 Apr 2004
  • United-States
  • Most Knowledgeable [Web Development/Programming] 2013
    Most Knowledgeable [GTA Series] 2011
    Best Debater 2010

#31

Posted 29 November 2011 - 05:00 AM

QUOTE (RajuGrewal @ Monday, Nov 28 2011, 10:08)
This program in in c not in c++

That program will compile in C or C++, because it uses C libraries. There is no C or C++ specific code anywhere in it.

QUOTE
You can write this in c++ like this..

Not in any compliant compiler. cout is part of the std namespace, so you either have to call it via namespace

CODE
std::cout<<"Whatever\n";


Or by selecting the namespace first.

CODE
using namespace std;
cout<<"Whatever\n";

The civilized way of programming it is by calling it via namespace, but a lot of lazy programmers simply rely on "using" in global scope, and unfortunately, a lot of programming books do the same, resulting in a bunch of people not even understanding what namespaces are and how you use them. No need to go far for example. What you wrote will throw an error "cout was not declared in this scope" in any civilized compiler.

So of the two of you, Swoorup is the one who had the code that would actually compile in ISO C++, and there you go, trying to teach him that it's not C++.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users