meysam_flash
Member
سلام دوستان
من کد مربوط به تبدیل تاریخ شمسی به میلادی و بالعکس رو میخواستم.خیلی واجبه.خیلی
ممنون.
من کد مربوط به تبدیل تاریخ شمسی به میلادی و بالعکس رو میخواستم.خیلی واجبه.خیلی
ممنون.
#include<iostream.h>
#include<conio.h>
void shamsi(int years,int months,int days);
main()
{
clrscr();
int year=0,month=0,day=0;
cin>>year;
cin>>month;
cin>>day;
shamsi(year,month,day);
getch();
return 0;
}
void shamsi(int years,int months,int days){
unsigned long int kabise=0,conyear=0,conmonth=0,conday=0,temp=0,count=0,
dayss=0;
//kabise
kabise=2008/4;
//convert shamsi to day
dayss=((years-1)*365)+((months-1)*31)+days+345;
dayss+=226899;
dayss-=kabise;
temp=dayss%365;
conyear=(dayss/365)+1;
if(temp>31){
if(temp>31){
temp-=31;
count++;
}
if(temp>31){
temp-=29;
count++;
}
if(temp>31){
temp-=31;
count++;
}
if(temp>31){
temp-=30;
count++;
}
if(temp>31){
temp-=31;
count++;
}
if(temp>31){
temp-=30;
count++;
}
if(temp>31){
temp-=31;
count++;
}
if(temp>31){
temp-=31;
count++;
}
if(temp>31){
temp-=30;
count++;
}
if(temp>31){
temp-=31;
count++;
}
if(temp>31){
temp-=30;
count++;
}
if(temp>31){
temp-=31;
count++;
}
conmonth=count+1;
conday=temp;
cout<<conyear<<"/"<<conmonth<<"/"<<conday;
}
}