zoukankan      html  css  js  c++  java
  • 输出多项数据

     1 #include <iostream>
     2 
     3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
     4 using namespace std;
     5 int main(int argc, char** argv) {
     6     //输出字符常量、变量和字符串
     7     char c1='A';
     8     cout<<'W';
     9     cout<<c1<<endl;
    10     cout<<"This is a test."<<endl;
    11     cout<<"------------------"<<endl;
    12 
    13     //输出整型常量、变量和表达式
    14     int n=100;
    15     cout<<10;
    16     cout<<n;
    17     cout<<2*n<<endl;   //输出整型表达式
    18     cout<<"------------------"<<endl;
    19 
    20     //输出浮点型常量、变量和表达式
    21     double pi=3.1415926,r=10.0,s=pi*r*r;
    22     cout<<pi<<endl;
    23     cout<<r;
    24     cout<<s;
    25     cout<<2*r*pi<<endl;      //输出浮点型表达式
    26     cout<<"------------------"<<endl;
    27     
    28     //一个cout可以输出多项数据
    29     cout<<'W'<<" "<<c1<<endl;
    30     cout<<"This is a test."<<endl;
    31     cout<<"pi="<<pi<<" r="<<r<<" s="<<s<<endl;
    32     return 0;
    33 }
  • 相关阅读:
    activiti并行和串行区别
    SpringMVC 封装返回结果对象
    maven基础
    activiti表
    SpringBoot进阶
    SpringBoot基础
    javascript ES6模块化
    Vuejs搜索下拉框
    Vuejs2.0 + bootstrap demo
    maven settings.xml
  • 原文地址:https://www.cnblogs.com/borter/p/9405627.html
Copyright © 2011-2022 走看看