#include<iostream>
using namespace std;
void main()
{
    int A(int n);//递归求阶乘
    cout << "请输入N值:";
    int i, N, sum = 0;
    cin >> N;
    if (N > 0)
    {
        for (i = N; i >= 1; i--)
        {
            sum += A(i);
        }
        cout << "结果:" << sum << endl;
    }
    else
        cout << "N必须为正整数!\n";
    system("pause");
}
int A(int n)
{
    if (n > 1)
        return A(n - 1)*n;
    if (n == 1)
        return 1;
}

#include<iostream>
using namespace std;
int main()
{
    int x, y=1, sum = 0;
    for (x = 1; x <= 6; x++)
    {
        y *= x;
        sum += y;
    }
    cout << sum << '\n';
    system("pause");
    return 0;
}

#include<iostream>
using namespace std;
int main()
{
    int x,a, b, c;
    for (x = 100; x < 1000; x = x + 1)
    {
        a = x / 100;
        b = (x / 10) % 10;
        c = (x % 10);
        if (x == (a*a*a) + (b*b*b) + (c*c*c))
            cout << x << endl;
        else;
    }
        system("pause");
    return 0;
}

/**************************
* 演示逻辑运算表达式       *
*************************/
#include<iostream>
using namespace std;
int main()
{
    int x = 0, y = 1, z = 1;      //注释:分别赋值x=0,y=1,z=1
    x && ++y && ++z;      //注释:
    cout << x << '\t' << y << '\t' << z << endl;  //x=0,y=1,z=1
    ++x && y++ &&z++;  //注释:先给x值+1,若x不等于0,则计算右边;判断y是否为0,若
    cout << x << '\t' << y << '\t' << z << endl;  //x=1,y=2,z=2
    ++x || y-- || ++z; //注释:
    cout << x << '\t' << y << '\t' << z << endl;  //x=2,y=2,z=2
    return 0;
}

#include<iostream>
using namespace std;
int main()
{
    float a,b,x;
    cout << "请分别输入a和b的值:";
    cin >> a >> b;
    x = a;
    a = b;
    b = x;
    cout << "a与b交换值后的结果是:" << a << '\t' << b << endl;
    system("pause");
    return 0;
}