#include<iostream>using namespaceStdintMain () {unsignedCharC1=24;intYearBOOLIsleapyear;/** input and output of data: * in C + +, the flow of data from one object to another is called a "stream". The stream is to be established before use and is deleted after use. * The operation of fetching data from a stream is called an extract operation, and the operation of adding data to the stream is called an insert operation. The input and output of the data is extracted by an I/O stream. * Cin and cout are predefined stream class objects. CIN is used to process standard input, i.e. keyboard input, cout is used to process standard output, i.e. screen output; * * *//*cout<< "Enter the Year:"; Cin>>year;isleapyear= (year%4==0 && year%100!=0) | | (year%4==0)); if (isleapyear) cout<<year<< "is a leap year" <<endl;elsecout<<year<< "was not a leap year!" <<endl;int Day;cin>>day;switch (Day) {case 0:cout<< "Sunday" <<endl;break;case 1:cout<< "Monday" <<endl;break;case 2:cout<< "Tuesday" <<endl;break;case 3:cout<< "Wednesday" << Endl;break;case 4:cout<< "Thursday" <<endl;break;case 5:cout<< "Friday" <<endl;break;case 6: cout<< "Saturday" <<endl;break;default:cout<< "Day out of range Sunday ... Saturday "<<endl;break;} int I=1,sum=0;while (i<=100) {sum+=i;i++;} cout<< "sum" <<sum<<endl;int i=1,sum=0;for (i=1;i<=100;i++) {sum+=i;} Cout<< "sum" <<sum<<endl;return 0;int i,j,sum;for (i=1,j=1;i<5,j<5;j++,i++) {sum=i+j;} int I=1,sum=0;for (;i<=100;) {sum+=i;i++;} **continue statement: Can appear in the loop body, the function is to end this cycle, and then start to decide whether to continue the next cycle. *goto statement: Format: Goto statement designator, where the statement designator is the identifier used to identify the statement, placed at the front of the statement, separated from the statement by a colon (:). The purpose of the **goto statement is to jump the execution process of the program to the statement specified by the statement designator. The goto statement, however, does not have a structure that destroys the architecture of the program and should be used sparingly or not. Custom data type: *typedef declaration: *typedef declares that there is a new type name table for the type name, * such as: typedef double area,volume;* Volume v;* area a;* enum type enum:* enum enum type name { Variable Value list}* enum weekday {sun,mon,tue,wed,thu,fri,sat};* is treated as constants on enumeration elements and cannot be assigned values. such as: sum=0 is illegal operation; * Enumeration elements can have default values, you can: * Enum Weekday {Sun=0,mon=1,tue=2,wed,thu,fri,sat};* enumeration can perform relational operations. * Integer values cannot be assigned directly to an enumeration variable, such as the need to assign an integer to an enumeration variable, which should be cast in a forced type. */typedef doubleArea,volume; Volume v; Area A; enum Weekday {sun=0,mon=1,tue=2, wed,thu,fri,sat}; cout<< "sum" <<sum<<Endl; return 0;}
-----------Feiruo----------
2015.07.15.23:48:37
My C + + notes (statement basic structure)