Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- using namespace std;
- double getX(double a, double b)
- {
- if (a > b)
- return 50 * (b / a) + b;
- else if (a < b)
- return (a - 5) / b;
- else if (a == b)
- return -100;
- }
- int main()
- {
- ifstream fileIn;
- fileIn.open("FileIn.txt");
- if (!fileIn.is_open())
- cout << "Error, FileIn.txt is not found" << endl;
- else
- {
- double a;
- fileIn >> a;
- double b;
- fileIn >> b;
- fileIn.close();
- double x = getX(a, b);
- cout << "Result: " << x << endl;
- ofstream fileOut;
- fileOut.open("FileOut.txt");
- fileOut << x;
- fileOut.close();
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement