• 让一个好端端的健壮青年无缘无故地吃人参补身体


    如果类 A 和类 B 毫不相关,不可以为了使 B 的功能更多些而让 B 继承 A 的功能和属性。

    不要觉得“白吃白不吃”,让一个好端端的健壮青年无缘无故地吃人参补身体。 

     1 #include <iostream>
     2 
     3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
     4 
     5 using namespace std;
     6 //定义输入函数模板
     7 template <class T> void input(char *str,T &x) {
     8     cout<<str<<"=";
     9     cin>>x;
    10 }
    11 
    12 //定义输出函数模板
    13 template <class T> void output(char *str,T x) {
    14     cout<<str<<"="<<x<<endl;
    15 }
    16 
    17 
    18 int main(int argc, char** argv) {
    19         //输入输出int型数据
    20     int a,b;
    21     input("a",a);
    22     output("a",a);
    23     b=3*a;
    24     output("3*a",b);
    25     output("a+b",a+b);
    26     cout<<"-------------------"<<endl;
    27 
    28     //输入输出double型数据
    29     double x,y;
    30     input("x",x);
    31     output("x",x);
    32     y=2*x;
    33     output("y",y);
    34     cout<<"-------------------"<<endl;
    35 
    36     //输入输出char型数据
    37     char c1;
    38     input("c1",c1);
    39     output("c1+2",char(c1+2));
    40     cout<<"-------------------"<<endl;
    41 
    42     //输入输出字符串数据
    43     char string[80];
    44     input("string",string);
    45     output("string",string);
    46     return 0;
    47 }
  • 相关阅读:
    关于session
    bootstrap的栅格系统
    js小知识点
    js获取div基础元素
    fixed固定元素
    定时器之延时触发鼠标悬浮事件
    Comparator分组测试
    List去重比较
    点击事件和双击事件
    开机自启动
  • 原文地址:https://www.cnblogs.com/borter/p/9417857.html
Copyright © 2020-2023  润新知