#include是头文件,里面有函数的实现,

 using namespace是引入命名空间,用于使用该库的变量,不加则该库中变量在引用时都需加“::”

cout输出,cin输入

 

#include<iostream>
#include<cmath>
#include<iomanip>
#include<windows.h>

using namespace std;


int main()
{
    int a, b, c;
    a = 1;
    b = 1;
    c = 1;
    int result1 = a++;//++,--在右先赋值后自+1或-1
    int result2 = --b;//++,--在左先自+1或-1再赋值
    int result3 = c--;
    cout << result1 << "\t"
        << result2 << "\t"
        << result3 << "\n"
        << "a:" << a << "\t"
        << "b:" << b << "\t"
        << "c:" << c << "\t" << endl;
    system("pause");









    //double attack1, attack2, attack3;
    //attack1 = 120;
    //attack2 = 130;
    //attack3 = 140;

    //cout << left;//左对齐
    //cout << setfill('_');//填充
    //cout << setw(8) << attack1
    //    << setw(8) << attack2
    //    << setw(8) << attack3 << endl;
    //system("pause");
    //return 0;




    //int num;
    //char ch1, ch2, ch3;
    //cout << "请输入一个数字\t";
    //cin >> num;//假设用户输入:123abc
    //cin >> ch1 >> ch2 >> ch3;
    //cout << num << "\t" << ch1 << "\t" << ch2 << "\t" << ch3 << endl;
    //system("pause");





    //////打印德玛西亚之力
    //SetConsoleTitle("打印德玛的详细信息");
    ///** 伤害 */  //**文档注释
    //double value_attack = 57.88;
    //int a;
    //cin >> a ;
    //cout << a << endl;
    //cin.get();
    //system("pause");
    //return 0;
    




    /*
    int salary = 15000;
    cout << "manuel的月薪是:"<<salary << endl;
    getchar();
    return 0;
    */

    //已知圆柱体的半径和高,求体积
    /*
    const float Pi = 3.14;//定义常量Pi
    float radio = 4.5, height = 90.0;
    double Volume = Pi*pow(radio, 2)* height;
    cout << "圆柱体的体积是:"
        << Volume << endl;
    */

    /*
    //控制cout的显示精度
    //1.强制以小数的方式显示
    cout << fixed;
    //2.控制显示的精度
    cout << setprecision(2);
    //输出double类型数据
    double doubleNum = 100.0 / 3.0;
    cout << doubleNum * 10000 << endl;
    cin.get();w 
    getchar();//得到用户的单个字符
    return 0;
    */

    /*
    //sizeof 用来测量数据类型的长度
    cout << sizeof(double) << endl;
    cout << sizeof(long double) << endl;
    getchar();
    return 0;
    */
}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

11111

posted on 2019-09-06 20:22  Manuel  阅读(189)  评论(0编辑  收藏  举报