Showing posts with label switch. Show all posts
Showing posts with label switch. Show all posts

Tuesday, September 20, 2016

Print Name In A User Defined Color

Program To Print Name In a Color Selected By User

#include<iostream>
using namespace std;
main()
{
    int x;
    string s;
    cout<<"Enter Your Name";
    cin>>s;
    cout<<"PRESS 0 for Black\n1 for Blue\n2 for Green\n3 for Aqua\n4 for Red\n5 for Purple\n6 for Yellow\n7 for White\n8 for Gray\n9 for Light Blue\n";
     cin>>x;
     switch(x)
     {
         case 0: system("COLOR 0");
         break;
         case 1: system("COLOR 1");
         break;
         case 2: system("COLOR 2");
         break;
         case 3: system("COLOR 3");
         break;
         case 4: system("COLOR 4");
         break;
         case 5: system("COLOR 5");
         break;
         case 6: system("COLOR 6");
         break;
         case 7: system("COLOR 7");
         break;
         case 8: system("COLOR 8");
         break;
         case 9: system("COLOR 9");
         break;
         default:
             cout<<"ENTER VALID NUMBER"; }   
    cout<<s;
}