Computer Forums

Computer Forums (http://www.computerforums.org/forums/)
-   Programming (http://www.computerforums.org/forums/programming/)
-   -   C++ Commands (http://www.computerforums.org/forums/programming/c-commands-170766.html)

acro 12-08-2007 07:19 AM

C++ Commands
 
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.

88 12-08-2007 02:10 PM

Re: C++ 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).

AllThingsSacred 12-08-2007 05:01 PM

Re: C++ Commands
 
http://www.planetpdf.com/developer/a...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.


All times are GMT -5. The time now is 01:52 PM.

Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0