C++入门经典-例2.4-使用scanf格式输入函数得到用户输入的数据

1:puts函数可以输出提示信息的字符串。

2:代码如下:

C++入门经典-例2.4-使用scanf格式输入函数得到用户输入的数据C++入门经典-例2.4-使用scanf格式输入函数得到用户输入的数据
// 2.4.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"


int main()
{
    int iInt1,iInt2;                                /*定义两个整型变量*/
    puts("请输入两个数字");                /*通过puts函数输出提示信息的字符串*/
    scanf("%d%d",&iInt1,&iInt2);                    /*通过scanf函数得到输入的数据*/
    printf("第一个数字是 : %d\n",iInt1);                    /*显示第一个输入的数据*/
    printf("第二个数字是 : %d\n",iInt2);                /*显示第二个输入的数据*/
    return 0;
}
View Code

运行结果:

C++入门经典-例2.4-使用scanf格式输入函数得到用户输入的数据

posted @ 2017-09-11 09:19 一串字符串 阅读(...) 评论(...) 编辑 收藏

相关文章:

  • 2021-09-26
  • 2022-12-23
  • 2022-12-23
  • 2021-09-05
  • 2021-05-27
  • 2021-04-27
猜你喜欢
  • 2021-08-12
  • 2021-10-24
  • 2022-01-13
  • 2022-12-23
相关资源
相似解决方案