真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

C++程序記錄一

//C++語(yǔ)言的if/else判斷語(yǔ)句
#include
#include
using namespace std;
int main()
{
    char user_ans;
    cout << "現(xiàn)在正在下雨嗎Y/N?" << endl;
    cin >> user_ans;
    if ('Y' == user_ans || 'y' == user_ans)
    {
        cout << "現(xiàn)在正在下雨" << endl;
    }
    else
    {
        cout << "現(xiàn)在沒有下雨" << endl;
        cout << "今天會(huì)有太陽(yáng)嗎?" << endl;
        cin >> user_ans;
        if ('Y' == user_ans || 'y' == user_ans)
        {
            cout << "今天是晴天" << endl;
        }
        else
            cout << "今天是陰天" << endl;
    }
    system("pause");
}
#include
#include
#include
#include
using namespace std;
int main()
{
    vectornumb;//使用vector
    bool u_agg = true;
    int cnt = 1;
    int buffer;
    float avg;
    char u_ans;
    while (u_agg)
    {
        cout << "第" << cnt << "個(gè)數(shù)字:\n";
        cin >> buffer;
        numb.push_back(buffer);//vector的push_back()
        cout << "完成沒有?Y/N\n";
        cin >> u_ans;
        if ('N' == u_ans || 'n' == u_ans)
        {
            cnt++;
            continue;
        }
        else
        {
            u_agg = false;
        }
                 
    }
    for (int i = 0; i < numb.size() - 2; i++)//size()
        //這段目的可看出來,輸入相鄰的兩個(gè)數(shù)相加除以3
    {
        int sum = 0;
        for (int j = i; j < i + 2; j++)
            sum = sum + numb[j];
        avg = float(sum) / 3;
        cout << setiosflags(ios::fixed) << setprecision(2) << avg << " \n";
    }
    system("pause");
}
#include
using namespace std;
unsigned long int cnt(int n)//計(jì)算n的從0和n的每個(gè)數(shù)的 階乘之和
{
    unsigned long int sum = 0;
    for (int i = 1; i<=n; i++)
    {
        unsigned long int mul = 1;
        for (int j = 1; j <= i; j++)
            mul *= j;
        sum += mul;
    }
    return sum;
}
bool pass(int n)//判斷輸入的n是否在0和25之間
{
    if (n >= 0 && n <= 25)
        return true;
    else
    {
        cout << "n must between 0 and 25!\n";
        return false;
    }
}
int main()
{
    int n;
    unsigned long int sum;
    cout << "enter the number n:";
    cin >> n;
    while (pass(n))
    {
        sum = cnt(n);
        cout << sum;
        break;
    }
    system("pause");
}
#include//第一種圖形
using namespace std;
int main()
{
    int j = 0;
    for (int i = 1; i <= 9; i++)
    {
        for (int k = 1; k <= i; k++)
        if ((k + j) % 9)
            cout << (k + j) % 9 << " ";
        else
            cout << 9 << " ";
        cout << endl;
        j = j + i;
    }
    system("pause");
}
#include//第二種圖形
using namespace std;
int main()
{
    int j = 0;
    for (int i = 1; i <= 9; i++)
    {
        for (int m = 0; m < 9 - i; m++)
            cout << " ";
        for (int k = 0; k <= i; k++)
        {
            if ((k + j) % 9)
                cout << (k + j) % 9 << " ";
            else
                cout << 9 << " ";
        }
        cout << endl;
        j = j + i;
    }
    system("pause");
}
#include//第三種圖
using namespace std;
int main()
{
    int j = 0;
    for (int i = 1; i <= 9; i++)
    {
        for (int k = 1; k <= 8; k++)
        if ((k + j) % 9)
            cout << (k + j) % 9 << " ";
        else
            cout << 9 << " ";
        cout << endl;
        j = j + 8;
    }
    system("pause");
}

當(dāng)前題目:C++程序記錄一
轉(zhuǎn)載來于:http://weahome.cn/article/gdodhh.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部