Program to display the different colors using the switch statement.

#include<iostream>
using namespace std;
int main()
{
int a;
cout<<"Enter the value to display the colour\n\n1.Red\n2.Blue\n3.Green\n4.White\n5.Black"<<endl;
cout<<"Enter Your Choice:";
cin>>a;
switch(a)
{
case 1:
cout<<"Colour is Red\n";
break;
case 2:
cout<<"Colour is Blue\n";
break;
case 3:
cout<<"Colour is Green\n";
break;
case 4:
cout<<"Colour is White\n";
break;
case 5:
cout<<"Colour is Black\n";
break;
default:
cout<<"No Result\n";
}
cout<<"/*\nName-Sanjampreet Singh\nRoll Number-1507967\n*/";
}

Output:


Comments

Popular posts from this blog

To implement the various components of HTML5 Canvas

Program to illustrate the concept of templates.

Program to illustrate the order of execution of constructors and destructors in inheritance.