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

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

2:代码如下:

// 2.4.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"


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

运行结果:

原文地址:https://www.cnblogs.com/lovemi93/p/7503409.html