首页 > 其他 > 详细

cin、cout

时间:2020-01-31 19:38:04      阅读:78      评论:0      收藏:0      [点我收藏+]

后缀名

C语言:C
OC:m
JS:js
JAVA:java 先有类,再有函数 eclipse
C++:cpp c plus plus 完全兼容C语言,以前叫c with classes(带有类的C语言)

C++程序的入口是main函数(函数和方法一个意思和本质,汇编一模一样,随意叫)

cin(从键盘接收)、cout

cin、cout控制台的输入,输出
依赖于上下文

#include <iostream>
using namespace std;
cout << "test1";
cout << endl;
cout << "test2";
//等价于下面这个
cout << "test1" << endl << "test2";
//cin从键盘接收数据
int age;
cin >> age;
cout << "age is" << age << endl;

cin、cout例子

#include <iostream>
using namespace std;

int main() {
    cout << "please type a number:" << endl;

    int age;
    cin >> age;
    cout << "age is " << age << endl;

    getchar();
    return 0;

}
  • main函数退出,程序就结束了。

解决方案-右键-文件资源管理器打开文件夹

cin、cout

原文:https://www.cnblogs.com/sec875/p/12246165.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!