Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  taghvim
Language: C/C++
Code:
#include <iostream>
#include <time.h>
using namespace std;
class taghvim
{public:
void ctime()
{int day,month,count;
time_t rawtime;
struct tm * ptm;
time(&rawtime);
ptm=localtime(&rawtime);

day=ptm->tm_yday-78;
month=day/31;
if(month>6)
month=6;
day -= month*31;
if(day !=0)
{count=day/30;
month += count +1;
day -=count *30;}
else
day=31;
if(day==0)
{day=30;
month--;}
int year=1398;
cout<<day<<"/"<<month<< "/"<<year<<"/";
switch(month)
{case 1:
cout<<"farvardin";
break;
case 2:
cout<<"ordibehesht";
break;
case 3:
cout<<"khordad";
break;
case 4:
cout<<"tir";
break;
case 5:
cout<<"mordad";
break;
case 6:
cout<<"shahrivar";
break;
case 7:
cout<<"mehr";
break;
case 8:
cout<<"aban";
break;
case 9:
cout<<"azar";
break;
case 10:
cout<<"dey";
break;
case 11:
cout<<"bahman";
break;
case 12:
cout<<"esfand";
break;}
int week=ptm->tm_wday;
cout<<"/";
switch(week)
{case 0:
cout<<"sun";
break;
case 1:
cout<<"mon";
break;
case 2:
cout<<"tue";
break;
case 3:
cout<<"wed";
break;
case 4:
cout<<"tur";
break;
case 5:
cout<<"fri";
break;
case 6:
cout<<"sat";
break;}
cout<<"__"<<ptm->tm_hour<<":"<<ptm->tm_min<<":"<<ptm->tm_sec;}};
int main()
{taghvim ta;
ta.ctime();
return 0;
cin.get();}
          
Comments: