I. Common Data Types
The program can process various types of data. We provide the program with data and get the expected results. Let's take a look at the exercises;
1. Start Geany
1) Click "Application-programming-Geany" in the menu to start Geany and create a c ++ source program;
2) Click the "file-save as" command in the menu and save the file to your folder with "shuju" as the file name;
2. Enter the program code.
1) in the following blue code area, enter a line "cout <18;" (read as c-out, and the last semicolon should not be missed );
# Include <iostream>
Using namespace std;
Int main (int argc, char ** argv)
{
Cout <18;
Return 0;
}
2) Save, compile, generate, and run the command to display a number 18, which is the numerical data;
3) Close the return to the program window, press the Enter key in front of the cout, insert a row,
Enter a line "cout <" 2*9 =;
Cout <"2*9 = ";
Cout <18;
4) Save, compile, generate, and run. This time, double quotation marks are added to the string data;
5) press the Enter key in front of the first cout, insert a blank line, and enter "cout <" 9 + 9 = "<9 + 9 <endl ;";
Cout <"9 + 9 =" <9 + 9;
Cout <endl;
6) The double quotation marks at the beginning of this line are strings, followed by the number addition operation,
The endl of the next line is the line break of the carriage return. If it is not added, it will be connected to the next line;
7) Save, compile, and run after generation. Now two lines are displayed;
8) Remember that double quotation marks are strings that can contain letters, numbers, and symbols, while ~ 9 is composed of numbers;
# Include <iostream>
Using namespace std;
Int main (int argc, char ** argv)
{
Cout <"9 + 9 =" <9 + 9;
Cout <endl;
Cout <"2*9 = ";
Cout <18;
Return 0;
}