anyone can help me with this?

Write a program that asks the user to enter three real numbers. if all three numbers are positives, print the sum else if one number is negative print the product of the two positive numbers. you will then ask the user to enter two real numbers. if both numbers are negative print the quotient, otherwise terminate the program. use fixed mode and format the output, in other words, specify the width and the number of digits meaningful variable names and informative prompts

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 #include <iostream>
#include <iomanip>
using namespace std;
int main()
{
	int x, y;
	cout << "Enter 2 intergers";
	cin >> x >> y;
	
	//simple ifs
	if (x > 0) cout << "The firs number is positive";
	if (x > 0 && y > 0) cout << "Both are positive";
	if (x > 0 || y > 0) cout << "At least one number is positive";


	//if-else 
	if (x > 0)cout << "The firs number is positive";
	else cout << "The first number is not positive";
	if (x > 0 || y > 0) cout << "at least one number is positive";
	else cout << "Both number are negative";

	//nested ifs
	if (x > 0) if (y > 0) cout << "Both are positive";
	else cout << "First number is positive, Second not positive";
	else cout << "First not positive, Second don't know";


	float a, b;
	cout << "Enter 2 real numbers";
	cin >> a >> b;
	cout << fixed << setprecision(2);
	if (a > 0 && b > 0) cout << "sum" << setw(12) << a + b << endl;
	return 0;
}
To start with you need 3 numbers so how about x, y and z ?
You should also set these values to zero. example int x=0;

Think about how you'd do it on paper...
Topic archived. No new replies allowed.