C++ Commands

acro

Beta member
Messages
3
Hey everyone, I'm getting interested in programming and I know that C is one of the better languages used in programming. If anyone would be willing to, say type out a list of common C++ commands and what they do, I think this thread would be helpful to many people even just for refreshing them-selves on some of the commands.
 
There aren't too many differences between C and C++. It's just there's no strings in C like in C++. For a string in C you must create an a character array with a null terminating character at the end '\0'.

Also there are no STL functions associated with C, hence why C++ is a little easier to learn.

printf in C is equal to cout in C++

scanf in C is equal to cin in C++ (well there are other ways for user input too in C)

I would recommend anyone to learn C if even they decide to learn C++ first because you get a much better understanding of memory allocation using the C language. C++ tends to do a lot of the work for you when it comes to memory allocation.

sorry that i didn't list out your commands, mostly because there are tons of them and some would take a page of writing to explain. I think it's easier to just look up a C/C++ tutorial. Actually my advice for getting a quick rundown of the C language is to pick up a book called "The C Programming Language" by Kernighan and Ritchie. I think it is by far the best book out there for this (C language that is).
 
http://www.planetpdf.com/developer/article.asp?ContentID=6634

The above link may help. I have found it to be extremely useful when I was learning the language.

As for commands, there are not commands as such, merely keywords which you use.

For example, here is a simple "Hello World!" program in C++.

Code:
#include <iostream>

int main (int argc, char* argv[])
{

std::cout<<"Hello World!\n"<<std::endl;

return (0);
}

I strongly recommend getting a book, or at least looking at some online tutorials.

C++ does actually do a little bit more memory management for you, but you must still do most of it unlike in languages like Java.

C++ is a very wide ranging language which has all manner of add-ons and external libraries you can use, but it can also get hellishly complicated later on. It may take you years to master it [as I have not, I must add; I am far from being an expert but am well versed in the basics], but good luck to you.
 
Back
Top Bottom