solution8 - CSCI-1100 Computer Science I Rensselaer...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CSCI-1100 Computer Science I Rensselaer Polytechnic Institute Spring 2004 Studio 8 -- Solutions 1. Msgs2 False Msgs2 Msgs2 2. #include "Canvas.h" #include <iostream> #include <string> using namespace std; void promptColor(Canvas& c, string s) { int colornum; // user chosen color // Get color from user cout << endl; cout << "Color List for the " << s << ":" << endl; cout << " 1. Red 2. Orange 3. Yellow" << endl; cout << " 4. Green 5. Blue 6. Indigo" << endl; cout << " 7. Violet 8. Black" << endl; cout << "Enter a color number (1-8): "; cin >> colornum; // Set the canvas to use the color chosen by the user if (colornum == 1) { c.SetColor(CanvasColor::RED); } else if (colornum == 2) { c.SetColor(CanvasColor::ORANGE); } else if (colornum == 3) { c.SetColor(CanvasColor::YELLOW); } else if (colornum == 4) { c.SetColor(CanvasColor::GREEN); } else if (colornum == 5) { c.SetColor(CanvasColor::BLUE); } else if (colornum == 6) { c.SetColor(CanvasColor::INDIGO); } else if (colornum == 7) { c.SetColor(CanvasColor::VIOLET); } else if (colornum == 8) { c.SetColor(CanvasColor::BLACK); }...
View Full Document

This homework help was uploaded on 04/16/2008 for the course CSCI 1100 taught by Professor Hardwick during the Fall '08 term at Rensselaer Polytechnic Institute.

Page1 / 2

solution8 - CSCI-1100 Computer Science I Rensselaer...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online