Sunday, October 30, 2016

C++ Diwali Special :):)

Tags

Its Time to Celebrate Diwali in C++ Style. Following C++ Program Display Outputs according to the System(PC) Dates.

Run this Program on Oct 30, 31 and on Nov 1 and check the Outputs.
You can add more Festivals by changing Date and Festival Name.
Happy DIWALI!!


#include <iostream>
#include <ctime>
#include <stdlib.h>
using namespace std;
void show(string festival);

int main()
{
string s;
system("COLOR 8B"); //Function to Change Text Color
    time_t currentTime;
    struct tm *localTime;

    time( &currentTime );                   // Get the current time
    localTime = localtime( &currentTime );  // Convert the current time to the local time

    int Day    = localTime->tm_mday; //Display Current Date
    int Month  = localTime->tm_mon + 1; //Months are counted from 0
    int Year   = localTime->tm_year + 1900; //Years are counted from 1900


if(Day==30&&Month==10&&Year==2016)
s="DIWALI";

else if(Day==31&&Month==10&&Year==2016)
s="VISHWAKARMA DAY";

else if(Day==1&&Month==11&&Year==2016)
s="BHAI DOOJ";
else
return 0;
cout<<"\n\n\n\n\n\tToday is "<<Day<<"/"<<Month<<"/"<<Year;

show(s);
    return 0;
}
void show(string festival)
{
cout<<"\n\tWish you a Very Happy "<<festival<<"!!\n";
cout<<"\tMay God bring you Luck and Help u Fulfill all your Dearest Dreams\n";

cout<<"\tHappy Coding!!\n\n";
cout<<"\tRegards,\n";

cout<<"\tDishant Mahajan\n\tNitesh Lekhi\n\tNaina Thaman\n\tHargun Kaur Gill\n";
cout<<"\t{gndecprogramming Bloggers}\n";
}





I got these Outputs by changing my PC's date.