Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void F(float x, float &y)
- {
- if (x > 0)
- y = x;
- else if (x >= (-1) && x <= 0)
- y = 0;
- else y = pow(x, 2);
- }
- float F(float x)
- {
- float y;
- if (x > 0)
- return x;
- else if (x >= (-1) && x <= 0)
- return 0;
- else y = pow(x, 2);
- return pow(x, 2);
- }
- int main ()
- {
- float x, y;
- cin >> x;
- cout << "Result float: " << F(x) << endl;
- F (x,y);
- cout << "Result void: " << y << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement