zoukankan      html  css  js  c++  java
  • 如果某一常量与其它常量密切相关,应在定义中包含这种关系,而不应给出一些孤立的值

    如果某一常量与其它常量密切相关,应在定义中包含这种关系,而不应给出一些孤立的值。

    例如: const float RADIUS = 100; const float DIAMETER = RADIUS * 2;

     1 #include <iostream>
     2 #include <string>
     3 
     4 using namespace std;
     5 
     6 //测试字符串(string)对象
     7 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
     8 
     9 int main(int argc, char** argv) {
    10         //创建string对象,并显示
    11     string s1;
    12     string s2="ABCDEFGHIJK";
    13     string s3=s2;
    14     string s4(20,'A');
    15     string s5(s2,3,3);
    16     cout<<"s1="<<s1<<endl;
    17     cout<<"s2="<<s2<<endl;
    18     cout<<"s3="<<s3<<endl;
    19     cout<<"s4="<<s4<<endl;
    20     cout<<"s5="<<s5<<endl;
    21 
    22     //为string对象输入数据,并显示
    23     cout<<"s1=";
    24     cin>>s1;
    25     cout<<"s2=";
    26     cin>>s2;
    27     cout<<"s3=";
    28     cin>>s3;
    29     cout<<"s4=";
    30     cin>>s4;
    31     cout<<"s5=";
    32     cin>>s5;
    33 
    34     cout<<"s1="<<s1<<endl;
    35     cout<<"s2="<<s2<<endl;
    36     cout<<"s3="<<s3<<endl;
    37     cout<<"s4="<<s4<<endl;
    38     cout<<"s5="<<s5<<endl;
    39     
    40     return 0;
    41 }
  • 相关阅读:
    Python基础-博客
    已开发程序查询
    新语法
    html基础
    python操作excel
    Selenium
    练习2---(request,ajax爬取头条数据)
    练习1---request+正则(猫眼电影)
    框架---scrapy(基本用法)
    框架---Scrapy (框架安装)
  • 原文地址:https://www.cnblogs.com/borter/p/9413543.html
Copyright © 2011-2022 走看看