Tuesday, November 19, 2013

Is this C or C++?

Newsgroup: comp.lang.c++

Subject: Is this C or C++?

From: "crea" <no@...>

Date: Tue, 19 Nov 2013 21:44:40 -0000



Simple question. If the task is (for example):

"Write a C++ program which asks user his name (less than 20 chars) and

prints it."



Then, is this code a correct answer:



char name[100];

cout<<"Your name?"<<endl;

cin>>name;

cout<<name<<endl;



The point being, that the code uses C string "char name[]" and not C++

std::string.

C is a subset of C++, so isnt it logically speaking a C++ program?











via Usenet Forums - Usenet Search,Free Usenet - comp.lang.c++ http://www.pocketbinaries.com/usenet-forums/showthread.php?131968-Is-this-C-or-C&goto=newpost

View all the progranning help forums at:

http://www.pocketbinaries.com/usenet-forums/forumdisplay.php?128-Coding-forums

No comments:

Post a Comment