Study report from Pascal to C + + two days

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.