#include <conio.h>
int menu(void);
void setcolor(unsigned short color);
main()
{
while(1)
{
/*get selection and execute the relevant statement*/
switch(menu())
{
case 1:
{
setcolor(8);
puts(<q>You selected menu item 1n</q>);
puts(<q>Finished item 1 taskn</q>);
break;
}
case 2:
{
setcolor(11);
puts(<q>You selected menu item 2n</q>);
puts(<q>Finished item 2 taskn</q>);
break;
}
case 3:
{
setcolor(12);
puts(<q>You are quittingn</q>);
exit(0);
break;
}
default:
{
puts(<q>Invalid menu choicen</q>);
break;
}
}
}
return 0;
}
void setcolor(unsigned short color)
{
HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hcon,color);
}
}