为了避免测试程序的时候输入太麻烦,可以使用文件
最简单的方法是使用输入输出重定向,只需在main函数的入口处加入以下语句:
freopen{"input.txt","r",stdin};
freopen{"output.txt","w",stdout};
将使scanf从文件input.txt读入,printf写入文件output.txt。(三者在同一路径下)
为了避免测试程序的时候输入太麻烦,可以使用文件
最简单的方法是使用输入输出重定向,只需在main函数的入口处加入以下语句:
freopen{"input.txt","r",stdin};
freopen{"output.txt","w",stdout};
将使scanf从文件input.txt读入,printf写入文件output.txt。(三者在同一路径下)