博客
关于我
【C&C++】C++输入输出流
阅读量:296 次
发布时间:2019-03-01

本文共 392 字,大约阅读时间需要 1 分钟。

读取生日并输出问好信息

在C++中,使用cincout流对象来读取和输出数据。以下是实现步骤:

  • 包含必要的头文件<iostream>用于流对象。
  • 加载标准名空间:使用using namespace std;以简化代码。
  • 声明变量:分别存储年、月、日。
  • 读取输入:使用cin读取输入值。
  • 输出问好信息:使用cout拼接输出字符串。
  • #include 
    using namespace std;int main() { int y, m, d; cin >> y >> m >> d; cout << "Hello! " << m << " " << d << " " << y; return 0;}

    测试输入

    • 输入:1949 10 1

    • 输出:Hello! 10 1 1949

    • 输入:2005 3 6

    • 输出:Hello! 3 6 2005

    转载地址:http://foho.baihongyu.com/

    你可能感兴趣的文章
    python | cartopy,一个有趣的 Python 库!
    查看>>
    python | cloud-init,一个实用的 云计算 Python 库!
    查看>>
    python | code2flow,一个神奇的 Python 库!
    查看>>
    python | cudf,一个超实用的 Python 库!
    查看>>
    python | daphne,一个非常nice的 Python 库!
    查看>>
    python调用halcon
    查看>>
    python | doit,一个非常实用的 Python 库!
    查看>>
    python | easyocr,一个超厉害的 关于OCR的 Python 库!
    查看>>
    python | fastFM,一个高级的 Python 库!
    查看>>
    python | feature_engine,一个实用的 Python 库!
    查看>>
    python | filelock,一个超酷的 Python 库!
    查看>>
    python | fire,一个强大的 Python 库!
    查看>>
    python | flanker,一个神奇的 Python 库!
    查看>>
    python | flower,一个强大的 Python 库!
    查看>>
    python | funcy,一个超强的 提供函数式编程工具 Python 库!
    查看>>
    python | ggplot,一个超强的 Python 库!
    查看>>
    python | grab,一个强大的 Python 库!
    查看>>
    python | gunicorn,一个非常实用的 Python 库!
    查看>>
    python | h5py,一个无敌的关于 HDF5 的 Python 库!
    查看>>
    python | huey,一个非常厉害的 任务调度 Python 库!
    查看>>