1. Calls to libraries
#include <cstdio>//printf and SCANFD calls (formatted input output), GetChar () call (pause)
#include <cstdlib>//system () call (pause)
#include <iostream>//cin,cout calls (stream input and output)
#include <cstring>//and character related
(currently only see these, remember quite a lot of library)
2. Input and output
1) cin,cout
No special request ... (I think so now)
#include <cstring>#include<iostream>#include<cstdlib>#include<cstdio>using namespacestd;intMain () {CharA; Freopen ("zf.in","R", stdin); Freopen ("Zf.out","W", stdout); CIN>>A; cout<<" "<<a<<Endl; cout<<" "<<a<<a<<a<<Endl; cout<<a<<a<<a<<a<<a<<Endl; Fclose (stdin); Fclose (stdout); return 0;}
2) printf,scanf
1)%d integer decimal
2)%o integral type 8 binary
3)%x integral type 16 binary
4)%f real type (float)
5)%LF Real type (double)
Ps:\n for line break
#include <cstdio>using namespacestd;intMain () {Const DoublePi=3.1415926; Doubler,h,s1,s2,s; scanf ("%LF%LF",&r,&h); S1=pi*r*0; S2=2*pi*r*h; S=2*s1+S2; printf ("%0.3lf\n", s); return 0;}
3) file input/output
Freopen ("1.in","R", stdin); Freopen ("1.out","w", stdout); // called // Close
Just change "1.in" and "1.out".
3. Simple Assignment
Commonly used are:
+,-,*,/,%,++,--(arithmetic operator)
>,<,==,>=,<=,!= (relational operator)
(Logical and bitwise operations are not very well understood.) )
4. Data type
Integer: Int (length: Long)
Real type: double,float
Boolean type: BOOL
Focus!!!
Must be played: using namespace std;
Study report from Pascal to C + + two days