A solution to Problem X (1 point)
Here is a solution to Problem X. This program demonstrates several things.
Good things
Not so good things
// Problem X solution by Stuart Inglis
#include < iostream.h >
#include < fstream.h >
#include < assert.h >
void main(void)
{
int x1,x2;
ifstream infile("PROBLEMX.DAT", ios::in);
assert(infile);
while(1){
infile >> x1 >> x2;
if(x1 == 0 && x2 == 0) break;
cout << x1+x2 << endl;
}
}
|