// MERRY CRISTMAS -> BY PROGRAMMERS WAY
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
class XMas{
public:
void upperPart(int start, int end){
for(int i=start; i<=start+2; i++){
// Manage initial spacess
for(int j = i; j<=end; j++){
cout<<" ";
}
// Show first half
for(j=1; j<=i; j++){
if(j%5 == 0){
if(j%2 == 0)
{
textcolor(BLUE+BLINK);
cprintf(" *");
}
else
{
if(j%3 == 0)
{
textcolor(YELLOW+BLINK);
cprintf(" *");
}
else
{
textcolor(RED+BLINK);
cprintf(" *");
}
}
}
else
{
textcolor(GREEN);
cprintf(" *");
}
//cout<<" *";
}
// Show last half
cout<<"\n";
}
}
void lowerPart(int start, int len){
for(int i=1; i<=len; i++)
{
for(int j=1; j<start; j++)
{
cout<<" ";
}
textcolor(BROWN);
cprintf(" **");
if(i==len/2)
{
textcolor(RED+BLINK);
cout<<"\t";
cprintf("MERRY CRISTMAS");
}
cout<<endl;
}
}
};
int main(){
XMas obj;
clrscr();
obj.upperPart(1, 35);
obj.upperPart(6, 35);
obj.upperPart(12, 35);
obj.upperPart(17, 35);
obj.lowerPart(35, 10);
getch();
return 0;
}
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
class XMas{
public:
void upperPart(int start, int end){
for(int i=start; i<=start+2; i++){
// Manage initial spacess
for(int j = i; j<=end; j++){
cout<<" ";
}
// Show first half
for(j=1; j<=i; j++){
if(j%5 == 0){
if(j%2 == 0)
{
textcolor(BLUE+BLINK);
cprintf(" *");
}
else
{
if(j%3 == 0)
{
textcolor(YELLOW+BLINK);
cprintf(" *");
}
else
{
textcolor(RED+BLINK);
cprintf(" *");
}
}
}
else
{
textcolor(GREEN);
cprintf(" *");
}
//cout<<" *";
}
// Show last half
cout<<"\n";
}
}
void lowerPart(int start, int len){
for(int i=1; i<=len; i++)
{
for(int j=1; j<start; j++)
{
cout<<" ";
}
textcolor(BROWN);
cprintf(" **");
if(i==len/2)
{
textcolor(RED+BLINK);
cout<<"\t";
cprintf("MERRY CRISTMAS");
}
cout<<endl;
}
}
};
int main(){
XMas obj;
clrscr();
obj.upperPart(1, 35);
obj.upperPart(6, 35);
obj.upperPart(12, 35);
obj.upperPart(17, 35);
obj.lowerPart(35, 10);
getch();
return 0;
}

No comments:
Post a Comment