Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void solver(float x){
- cout << "Answer (y) is ";
- if(x > 7){
- cout << 1 / (x - 7) << endl;
- }
- else if (x < 8){
- cout << -3*x + 9 << endl;
- }
- }
- int main()
- {
- float x;
- cout << "Solver for function" << endl;
- cout << " −3𝑥 + 9 (when) x ≤ 7" << endl;
- cout << "f(x) = " << endl;
- cout << " 1 / (x - 7)" << endl;
- cout << "Enter your x: ";
- cin >> x;
- solver(x);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement