2016年8月24日 星期三

dev c++

DEV C++
File>>New>>Source File建立檔案
寫好後先Execute>>Compile
然後Debug
PS1:如果有錯,Debug會顯示出上一個程式
http://140.129.118.16/~richwang/99-1-Courses/UseDevCpp.pdf
*********************************
簡單印出輸入語法
#include<iostream.h>
int main(){
    int a,b,c;
    cout<<"two integers\n";
    cin>>a>>b;
    c=a+b;
    cout<<"sum is"<<c<<endl;
    system("PAUSE");
    return 0;
    }

平方語法
int x=2;
square(x);(平方,此時x值為4)


新函數要再上面宣告int或是void,其中int表示有回傳值
int sum(int,int);
...
cout<<....<<sum(x,y);

void sum(int,int);
...
sum2(x,y);

設定巨集
再#include...下面設
#define PI 3.14
#define S(r) PI*r*r
....
x=S(y);
...


陣列語法
int arr[5]={...};(宣告)
...

float abc[10][5]={...};(宣告)
...


http://jingyan.baidu.com/article/c1465413afdfb20bfdfc4c4e.html