need help with if and else

I have to write a program to out put string good, bad, great depending on the user input. Here is the question
A party is good if both tea(int) and candy(int) are at least 5. However, if either tea or candy is at least double the amount of the other one, the party is great. However, in all cases, if either tea or candy is less than 5, the party is always bad.
here is what I have so far...

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
#include <iostream>
#include <string>

using namespace std;

int main()
{   
    
    // Input
    cout << "Enter tea and candy (integers) : ";
    int tea, candy;
    cin >> tea >> candy;

    string result;
	
    if(tea < 5 || candy < 5) result = "bad";
	
    if(tea >= 5 && candy >= 5) result = "good";
        
    cout << "This is one " + result + " party!" << endl;
	
	return 0;
    

}

do not know how to write the code for "great"
I tried like
if(tea = (candy * 2) || candy = (tea * 2)) result = "great";
did not work
please help.

Last edited on
= is the assignment operator. If you want to compare values for equality, use the == operator

if(tea == (candy * 2) || candy == (tea * 2)) result = "great";
it worked
thank you for your help...
Topic archived. No new replies allowed.