First, common data types
The program can handle a variety of data, we provide data to the program, and then get the expected results, let's look at an exercise;
1, start Geany
1 point Menu "application-programming-geany" Start Geany, create a new C + + source program;
2 Point Menu "file-Save as" command, to "Shuju" as the filename, save the file to its own folder;
2, input program code
1 in the Blue Code area below, enter a line "cout << 18;" (read as C-out, the final semicolon do not leak);
#include <iostream>
using namespace Std;
int main (int argc, char** argv)
{
cout << 18;
return 0;
}
2 save, compile, build, run will display a number 18, this is the numerical data;
3 Closes the return to the program window, presses the ENTER key in front of the cout, inserts a row,
Enter a line "cout <<" 2*9= ";" The semicolon does not leak;
cout << "2*9=";
cout << 18;
4 save, compile, build, run, this time with a double quotation mark is called string data;
5 then click the ENTER key before 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 quotes in front of this line are strings, followed by numeric addition operations,
The next line of Endl is a carriage return line feed, if not added to the next line together;
7 save, compile, build and run, now shows two lines;
8 Here is required to remember: The double quotes are strings, which can have letters, numbers, symbols, and 0~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;
}