1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
|
//Compiler DevC++
#include<iostream>
#include<conio.h>
#include<Windows.h>
#define BLACK 0
#define BLUE 1
#define GREEN 2
#define CYAN 3
#define RED 4
#define PURPLE 5
#define YELLOW 6
#define LIGHT_GRAY 7
#define GRAY 8
#define LIGHT_BLUE 9
#define LIGHT_GREEN 10
#define LIGHT_CYAN 11
#define LIGHT_RED 12
#define PINK 13
#define MAGNETA 13
#define LIGHT_YELLOW 14
#define WHITE 15
using namespace std;
void Color(int textColor, int bgColor)
{SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), (textColor + (bgColor * 16)));}
COORD coord = {0, 0};
void gotoxy(int x, int y)
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
int red();
int yellow()
{
gotoxy(41,9);
Color(LIGHT_BLUE,LIGHT_YELLOW);
cout<<" ";
Color(LIGHT_YELLOW,LIGHT_GRAY);
for (int sec=10;sec>=0;sec--)
{
gotoxy(45,9);
if(sec<=9)
cout<<"0"<<sec;
else
cout<<sec;
Sleep(1000);
if(sec==0)
{ gotoxy(41,9);
Color(LIGHT_GRAY,YELLOW);
cout<<" ";
Color(LIGHT_GRAY,LIGHT_GRAY);
cout<<" ";
red();}
}
}
int green()
{
gotoxy(41,7);
Color(LIGHT_GRAY,LIGHT_GREEN);
cout<<" ";
Color(LIGHT_GREEN,LIGHT_GRAY);
for (int sec=10;sec>=0;sec--)
{
gotoxy(45,7);
if(sec<=9)
cout<<"0"<<sec;
else
cout<<sec;
Sleep(1000);
if(sec==0)
{ gotoxy(41,7);
Color(LIGHT_GRAY,GREEN);
cout<<" ";
Color(LIGHT_GRAY,LIGHT_GRAY);
cout<<" ";
yellow();}
}
}
int red()
{
gotoxy(41,5);
Color(LIGHT_BLUE,LIGHT_RED);
cout<<" ";
Color(LIGHT_RED,LIGHT_GRAY);
for (int sec=10;sec>=0;sec--)
{
gotoxy(45,5);
if(sec<=9)
cout<<"0"<<sec;
else
cout<<sec;
Sleep(1000);
if(sec==0)
{ gotoxy(41,5);
Color(LIGHT_GRAY,RED);
cout<<" ";
Color(LIGHT_GRAY,LIGHT_GRAY);
cout<<" ";
green();}
}
}
int main()
{ int start;
gotoxy(30,1);
system("color E1");
Color(LIGHT_BLUE,LIGHT_YELLOW);
cout<<"WELCOME TO TRAFFIC LIGHTS PROJECT";
gotoxy(12,3);
Color(BLACK,LIGHT_YELLOW);
cout<<"Hello Friends!";
gotoxy(15,4);
cout<<"I have Created This New Project, I Hope You Will Like This. . .";
gotoxy(15,5);
Color(LIGHT_RED,LIGHT_YELLOW);
cout<<"About This Project:";
gotoxy(15,6);
cout<<"THIS IS TRAFFIC LIGHT CONTROL SYSTEM";
gotoxy(15,7);
cout<<"In This Project Lights Turn ON and OFF Automatically After Each Ten Seconds";
gotoxy(28,11);
Color(GRAY, LIGHT_YELLOW);
cout<<"-*- PRESS ANY KEY TO SEE THE PROJECT -*-";
start=getch();
gotoxy(35,7);
system("CLS");
Color(BLACK,LIGHT_GRAY);
system("CLS");
Color(BLACK,LIGHT_GRAY);
gotoxy(38,3);
for(int top=0;top<=10;top++)
{
cout<<"\xdc";
}
int n=4;
for (int left=0;left<=7;left++)
{gotoxy(38,n);
cout<<"\xdb";
n++;
}
int m=4;
for(int right=0;right<=7;right++)
{
gotoxy(48,m);
cout<<"\xdb";
m++;
}
gotoxy(38,12);
for (int bottom=0;bottom<=10;bottom++)
{
cout<<"\xdf";
}
int c=12;
for(int stand=0;stand<=15;stand++)
{
gotoxy(43,c);
cout<<"\xdb";
c++;
}
gotoxy(38,27);
for(int Bottom_stand=0;Bottom_stand<=10;Bottom_stand++)
{
cout<<"\xdf";
}
gotoxy(41,7);
Color(WHITE,GREEN);
cout<<" ";
gotoxy(41,9);
Color(LIGHT_BLUE,YELLOW);
cout<<" ";
Color(BLACK,LIGHT_GRAY);
red();
getch();
}
|