Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since:
Apr 2017
Last Sign in:
103 Weeks Ago, 2 Days Ago
Questions Answered:
4870
Tutorials Posted:
4863
Education
MBA IT, Mater in Science and Technology
Devry Jul-1996 - Jul-2000
Experience
Professor
Devry University Mar-2010 - Oct-2016
Category > ProgrammingPosted 12 May 2017My Price8.00
This program lets the user select a primary color
I cannot figure out what I have done wrong in my code.
Â
// Lab 4 color.cpp// This program lets the user select a primary color from a menu.// Tessa Madsen#include <iostream>#include <string>using namespace std;int main(){int choice;// Menu choice should be 1, 2, or 3// Display the menu of choicescout << "Choose a primary color by entering its number. \n\n";cout << "1 Red \n" << "2 Blue \n" << "3 Yellow \n";// Get the user's choicecin >> choice;// Tell the user what he or she pickedif (choice == 1)cout << "\nYou picked red.\n";else if (choice == 2)cout << "\nYou picked blue.\n";else if (choice == 3)cout << "\nYou picked yellow.\n";else ((choice < 1) || (choice > 3));cout << "You must choose 1, 2, or 3.\n";cin >> choice;return 0;}