自考新教材-p279_1

阅读 137

2022-06-08

源程序:

#include <iostream>

using namespace std;

int main()

{

int x, y;

cin >> x >> y;

freopen("c:\\test.txt", "w", stdout); 

if (y == 0)                            

cerr<<"error."<<endl;

else

cout << x << "/" << y << "=" << x / y << endl;

system("pause");

return 0;

}

 运行结果:

输入:9 3

在c盘上产生文本文件test.txt,内容为:9/3=3


精彩评论(0)

0 0 举报