What will we learn?
a
Requirements:
Program download link : Download
Why is it dev-c++?
Difficulty Level:
Let's Start the Course :
C ++ Language Writing and Punctuation Rules
As with any language , there are some spelling and punctuation rules in C++. If you don't follow these rules , you'll get a mistake. Below are the important spelling and punctuation rules.
Semicolon ;
In C++ and other C-based languages , semicolons(;) are placed at the end of each command.
init x=0, y, top=0;
x=x+1;
top=top+x;
A semicolon indicates that a command is finished and that another command can start. For example, you can type 'cout<< <' and 'cin>>' commands side by side , or you can type 'cout < <' at the bottom.
cout<<"YourAge:"; cin>>age;
or
cout<<"YourAge:";
cin>>age;
For better readability of the program , more than one command is usually not written on a line. Single command is preferred on each line.
Forgetting a semicolon is one of the most common mistakes in C++.
Nice(Fancy)Braces {...} and block concept:
The C++ language consists of blocks. Set the Start and end position of blocks , also called Nice or fancy parentheses. For example, our main program ' main()' starts with ({) and ends with (}).
{...} the commands in the marks are called blocks. A block is a collection of commands that are assembled for a particular purpose, and they ensure that the corresponding code is distinguished. Blocks also help make the program more readable .
int main ( )
{ //Block Start
command1
command2
command3
}//Block End
Each opening parenthesis or block must be closed. If you don't turn it off , you'll get an error , which is another very common error.Therefore , if you open a beautiful parenthesis, be sure to close it immediately , then close it without writing the code into it.
Space Character
The space characters for the C++ language have no meaning. In C++, space characters are not compiled. Therefore , you can use as many spaces as you want. In general,a lot of space characters are used to make the program read better.
init main() {cout<<"Hello Utopian"; return 0; }
The above program writes "Hello Utopian" to the screen. returns '0' to the operating system and waits. Because all commands are written side by side and without spaces , it is a bit difficult to read. If we write the above program using empty and subline,it will be read more easily as shown below.
int main ( )
{
cout<<"Hello Utopian";
return 0;
}
If careful, the code in the above program is distributed to different lines and the commands inside the block are written in , the readability is increased. If you use 'dev-C++' as the editor,it will try to handle the regular use of spaces itself.
Capitalization and lowercase usage
The C ++ language is a case-sensitive language. So, for the C ++ language, "Utopian" and "Utopian" are different things.
int x=1;
int y=2;
init total=0;
TOTAL=x+y;
cout<<TOTAL;
n the above program, three variables named x, y and total are defined. In the following lines, "TOTAL" is written instead of "total". You will get an error because "total" and "TOTAL" are different things.
For example, if you type 'cout <<' incorrectly as 'Cout <<', you will get an error. To avoid such mistakes, I recommend you to write careful code as much as possible. Some editors have an automatic code completion feature called 'Intellisense'. This feature ensures that both commands are completed and written correctly.
** Variables:**
Variables are memories used to temporarily store values generated from the outside or generated in the program.
Variable according to the size and type of the data to be stored must be different boutta and type. In the table below you can see some data and types that can be read from the outside.
| Read Value | Variable DataType |
|---|---|
| 5 | left-aligned |
| 23500 | 0:255 small integer between ( unsigned char) |
| -125000 | 0:65535 integer between ( unsigned short) |
| -125000 | -2billion:+2billion between (int) |
| 3,14 | Decimal Number ( float) |
| 'a' | Character ( char ) |
| "Hello Utopian" | Text ( String ) |
The most important thing to pay attention to is the compatibility of the external variable with the value to be assigned:
variable ( same data type ) = value ( same data type );
**Variable Physical Structure: **
In short, I would like to talk a little bit about the physical structure of the variables. The variables, RAM, are stored in shelf-like areas in memory. The memory that stores 8 0's or 1's memories creates one and 1 Bytes of memory together. In the RAM memory, 1 byte of memories are arranged like sub-sub racks.
Some information:
The ram memory structure is especially important for variables and data types. The different types of data stored in the memory are different amounts of space. Here are some examples:
Series :
1 - C++ Programming Languages With / Series 1 #1