#include<iostream>

using namespace std;

int main()

{

    char x;

    cout<<"Meau:A(dd) D(elete) S(ort) Q(uit),Select one:"<<endl;

    while(true)

    {

        cin>>x;

        if(x=='Q')

    break;

    if(x=='A')

    {

    cout<<"數(shù)據(jù)已經(jīng)增加"<<endl;continue;

}

    else if(x=='D')

    {

    cout<<"數(shù)據(jù)已經(jīng)刪除"<<endl;continue;

}

    else if(x=='S')

    {

    cout<<"數(shù)據(jù)已經(jīng)排序"<<endl;continue;

    }

}

     

 

return 0;

} 

#include<iostream> 

using namespace std;

int main()

{

    char x;

    cout<<"Meau:A(dd) D(elete) S(ort) Q(uit),Select one:"<<endl;

    while(true)

    {

        cin>>x;

        switch(x)

        {

            case 'A':cout<<"數(shù)據(jù)已經(jīng)增加"<<endl;continue;

            case 'D':cout<<"數(shù)據(jù)已經(jīng)刪除"<<endl;continue;

            case 'S':cout<<"數(shù)據(jù)已經(jīng)排序"<<endl;continue;

            case 'Q':break;

        }

         

    }

    return 0;

}

#include<iostream>

using namespace std;

int main()

{

    int i,n;

    for(i=2;i<=100;i++)

    {

        for(n=2;n<i;n++)

        {

            if(i%n==0)

            break;

        }

        if(i==n)

        cout<<i<<endl; 

    }

 

    return 0;

} 

#include<iostream>

using namespace std;

int main()

{

    int i=2;

    while(i<=100)

    {

        int n=2;

        while(n<i)

        { 

        if(i%n!=0)

        ++n;

        else

        break;

        }

        if(i==n)

        cout<<i<<endl;

        i++;

    }

    return 0;

}

#include<iostream>
#include<cstdlib>
using namespace std;
int sj()
{
    int sj=rand()%101;
    return sj;
}
int main()
{
    unsigned seed;
    int n,js;
    cout<<"輸入種子"<<endl;
    cin>>seed;
    while(true)
    {
    srand(seed);
    js=sj();
    cout<<"輸入猜的數(shù)"<<endl;
    cin>>n;
    if(n!=js)
    {
        cout<<js<<endl<<"再猜一次"<<endl;
        seed=js;
        continue;
    }
    else
    cout<<"你猜對了"<<endl;
    break;
    }
return 0;     
}

#include<iostream>

using namespace std;

int main()

{

    int t;

    for(int i=1;i<=5;i++)/*剩下一個球*/

    {

    for(int m=1;m<=4;m++)/*剩下第二個球*/

     t++;

    }

cout<<"共有"<<t/2<<"種方法"; /*有一遍重復*/

return 0;

}

四.1.(1)函數(shù)聲明表示有這么一個函數(shù)的存在,而函數(shù)定義則具體實現(xiàn)這個函數(shù)

(2)形參就是只在被調(diào)用時存在,并且在函數(shù)中不斷改變,而實參則存在于函數(shù)之外,不會改變。

函數(shù)參數(shù)節(jié)約了內(nèi)存,也使函數(shù)更為簡便。返回值就是經(jīng)一系列計算得來的某一數(shù)據(jù),返回至原函數(shù),來得出相應的值。

(3)值傳遞僅僅傳遞了值,而引用傳遞則傳遞了相應的內(nèi)存地址。

五.收獲:同一個問題可能有多種解決方法,我們需要做的則是開闊創(chuàng)新,發(fā)現(xiàn)新的更好的方法。