Self new textbooks -p279_1

Source:

#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;

}

 operation result:

Input: 93

Generating a text file on the disc c test.txt, content: 9/3 = 3

Guess you like

Origin www.cnblogs.com/duanqibo/p/12235657.html