Program that shows secondary colors made from primay colors

I'm trying to write a basic program that takes primary colors and shows the user a secondary color made from two inputted primary colors. Its been two years since I took a logic class and I'm not grasping programming. Here is my code I've been tinkering with. Thanks for any input.

Jeff

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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
  //This program will help teach the user the primary colors as well as the 
//addional colors that can be made by mixing the primary colors together.

#include <iostream>
#include <istream>
#include <string>

using namespace std;


int main()

{

	string userName;
	cout << "Enter your name  ";
	getline(cin, userName);
	cout << "Hello " << userName << endl;
	int blue;
	int green;
	int red;
	

	cout << "There are three primary colors: blue, green and red. " << endl;
	cout << "Pick two primary colors to see what new color is made: " << endl;
	


	{

		cin >> blue, green, red;
		if (blue && green)
		{
			cout << "The secondary color made is cyan " << endl;
		}
		else if (blue && red)
		{
		
			cout << "The secondary color is magenta " << endl;
		}
		else if (green && red)
		{
			cout << "The secondary color made is yellow.  " << endl;
		}
	}

	system("pause");

	return 0;
}
What is the user supposed to input? Your program implies the user input three numbers which are zero or non-zero in a specific order.

Your cin statement at line 31 is faulty. It should be:
 
cin >> blue >> green >> red;

I'm want the user to input two of the three primary colors and the program to output the correct secondary color.

Thanks for the assistance.
Topic archived. No new replies allowed.