zoukankan      html  css  js  c++  java
  • 变量和数据类型

    #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 << "	"
            << result2 << "	"
            << result3 << "
    "
            << "a:" << a << "	"
            << "b:" << b << "	"
            << "c:" << c << "	" << 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 << "请输入一个数字	";
        //cin >> num;//假设用户输入:123abc
        //cin >> ch1 >> ch2 >> ch3;
        //cout << num << "	" << ch1 << "	" << ch2 << "	" << 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

  • 相关阅读:
    Gradle学习之基础篇
    springmvc上传文件方法及注意事项
    SpringCloud学习之feign
    SpringCloud学习之eureka集群配置
    SpringMvc+Spring+MyBatis 基于注解整合
    SpringBoot学习之SpringBoot执行器
    SpringBoot跨域问题解决方案
    SpringCloud学习之快速搭建分布式配置
    MySQL-Innodb存储结构
    PG-流复制
  • 原文地址:https://www.cnblogs.com/Manuel/p/11478035.html
Copyright © 2011-2022 走看看