cmd 输入输出

cmd 输入输出

首先在编写如

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>

void main()
{
	int a = 0;
	scanf("%d",&a);
	printf("%d\n",a);
	system("pause");
}

生成 cmd.exe, 打开 cmd 并进入到 cmd.exe 的目录

我们可以再新建以个1.txt并在里面输入 123

在cmd窗口中输入:

< : 是将 1.txt 中输入的数据输出到 cmd.exe 正如代码中的 scanf() 接受

> : 是将 cmd.exe 输入的数据输入到 2.txt 中正如 printf()

还可以将cmd内容输出到文本例如:

就会生成 3.txt:
3.txt

posted @ 2020-03-10 11:17  放飞梦想C  阅读(1102)  评论(0编辑  收藏  举报