C + + is a powerful programming language to create a program. C + + is a high level language which is the development of C language, where language is a programming language objects berorentasi (unlike his predecessor, C). Say medium because this language is between high-level language and low. High level language is a language more "manusawi", because the command - the command of this language is more oriented to human language. Visual Basic (VB) and Pascal are two of several examples of high-level languages. While low-level language is more oriented language to machine language so that language is not very "humane".
Writing in C + + is case sensitive. Which means, C + + distinguish between small and capital letters. Which means (again): variabel_pertama not the same as variabel_Pertama or mboknya_echi not the same as mboknya_Echi.
Comments in C + + written with '/ /' for a long comment with a line or '/ *' and '* /' to comment more than one line, where the sign / * is the "opening" of comments and * / is a "cover" comment. Cataatan ang comment was written by a programmer for a reminder or explanation when reading a code. Words - words in a comment will not be executed by the compiler.
Some mistakes in writing in C + + is:
- int int; / * one because the name of a variable should not be the same as seuah data types (int) * /
- int Jam_9; / / false because the variable names begin with capital letters
- int 90jam; / * well, this is also wrong because the name of a variable can not start with numbers * /
- int Myint; / / true
- char kata_2; / / that's right ...
- double bilangan_KeDuA; / * if name identifiernya strange, but it is also true:) * /
int a, b, c;
a = 1;
b = 2;
c = a + b;
While writing the wrong is:
int a, b, c
because it is considered an error by the compiler, because it is an incomplete statement.
Type - the type of data is known in C + + are as follows:
* Int
int is an integer data type (integer). Examples of the use of type int is:
int a = 1;
int num1 = 2, num2 = 4;
Note that the value - the value entered in the assign (enter) into a variable - a variable of type int is a number - number / integer. Like its name, int value can only be round and not fractions (decimals). What if the type int and that included the results of the division that is not round results? Then:
int hasil_bagi_bulat = 5 / 2;
The result: 2
This is because 5 divided by 2 = 2.5 and then because hasil_bagi_bulat is an integer (whole number) 2.5 and then rounded to 2.
To own a decimal to a certain type of these numbers.
* Double
is a special type that are not round numbers, aka decimal / fraction. Example usage is:
double mydouble = 5:00;
double pecahan_pertama = 2.5, pecahan_kedua = 9.9;
* Char
is a character data type can store starting from: a - z, A - Z, '!', '@', etc.. Penggunannya ± equal to the type - the type that previously:
char letter = 'c';
inisial1 char = 'A', inisial2 = 'W';
char symbol = '#';
* Bool
is the type who just "hold" value "true" and "wrong" that is, true and false (boolean). Example:
benar_atau_salah bool = true;
*
* String
is a special type to accommodate all the input from the user / character combination is very long. For example:
string string_gue = "nah, kyk gini deh example string ...";
* Arithmetic operators used in C ++ is:
• '+' = sum
• '-' = reduction
• '*' = multiplication
• '/' = division
• '%' = remainder of (Modulo)
No comments:
Post a Comment