CellPhone 发布的文章

#include<iostream>
using namespace std;
int main()
{
    float a,b,c,d;
    cout <<"请输入三个数:";
    cin >> a >> b >> c;
    d = a > (d = (b > c) ? b : c) ? a : d;
    cout <<"这三个数中最大的是:"<< d << endl;
    system("pause");
    return 0;
}

#include <iostream>
using namespace std;
int main()
{
    int x, a, b, c, d;
    int s = 0;
    cout << "请输入一个四位数整数:" ;
    cin >> x;
    a = x % 10;
    b = x / 10 % 10;
    c = x / 100 % 10;
    d = x / 1000 % 10;
    s = a + b + c + d;
    cout <<"每位数相加之和为:"<< s << endl;
    system ("pause");
    return 0;
}

/*************************
*   程序名:平行四边形    *
*   功  能:Unknown      *
*************************/
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
    cout << setw(23) << "***************" << endl;
    cout << setw(8) << "*" << setw(14) << "*" << endl;
    cout << setw(7) << "*" << setw(14) << "*" << endl;
    cout << setw(6) << "*" << setw(14) << "*" << endl;
    cout << setw(19) << "***************" << endl;
    system("pause");
    return 0;
}

/*****************************************************************************
*   程序名:双数计算器                                                         *
*   功  能:运用输入和输出流运算符,分别对两个数进行加、减、乘、除的运算并输出结果  *
*****************************************************************************/
#include<iostream>
using namespace std;
int main()
{
    float num1, num2;
    cout << "Please input two numbers:";
    cin >> num1 >> num2;
    cout << "Addition result is:" << (num1 + num2) << endl;
    cout << "Subtraction result is:" << (num1 - num2) << endl;
    cout << "Multiplication result is:" << (num1 * num2) << endl;
    cout << "Division result is:" << (num1 / num2) << endl;
    system("pause");
    return 0;
}