Owo C++

Learning something about C++ on sololearn.com!

The first command:

Capture.JPG

How complicated and long it is!

They say:

+ sign # at the beginning to target the compiler’s pre-processor.

+ #include tells the pre-processor to include the <iostream> header.

+ the <iostream> header defines the standard stream objects that input and output data.

+ using namespace std; tells the compiler to use the std (standard) namespace.

+ cout << “Hello world!”;  : display to the screen “Hello world!”. cout is used to write output to the standard output, usually the screen.

+ return 0;

Capture.JPG

Try the above code in here!

What do I need to start coding C++?

+ IDE

+ Compiler like: GNU GCC;…

Starting

endl;   << << ;

\n \N

comment: // this is a comment

/* this is a

long comment */

variable in C++

+ var # vaR

+ cout<< var; to print to the screen var  || cin >> var get input from the user and assign it to var.

+ cin >> a>> b; to require more variables, when input the value use: space(s) between variables or break line.

+ a++ and ++a : Code.

Condition and Loops

Not different code of other programing language.

+ if () {;}

+ while () {;}

+ for ( init; condition; increment ) {}

+ do {} while ()

+ switch (expression) {

case value: statement; break;

default:

}

Logical Operators

&&   AND

||   OR

!  NOT

Data Types

They say: ‘a’ is a character but “a” is a string.

signed: A signed integer can hold both negative and positive numbers.
unsigned: An unsigned integer can hold only positive values.
short: Half of the default size.
long: Twice the default size.

Eg: unsigned int aaa;  (aaa = 1 but cant be -1)

Floating point numbers: float, double, and long double.

String | Char | Boolean

Array : type to declear a array of integers have size is 9.

int myArray[9];

OMG

Dynamic Memory 😦

sizeof(data type)

Function

int nameFunc(int var1, int var 2)

{

statement;

}

rand();

srand();

recursion();

 

 

Advertisements
Posted in C++

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s