TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: STEVEN READ
from: EDWARD RUTLEDGE
date: 1997-06-24 01:29:00
subject: Part 3 of 3 I hope

long to_julian ( ) 
	{ 
	cout << "Enter year:  "; 
	cin >> year; 
	leap_year ( year ); 
	month = in_month ( ); 
	day = in_day ( month ); 
	total_days = Total_days ( day, month ); 
	return ( year * 1000 ) + total_days; 
	} 
 
long to_julian ( int month, int day, long year ) 
	{ 
	long temp; 
 
	temp = leap_year ( year, 1000 ); 
	total_days = Total_days ( day, month ); 
	return temp + total_days; 
	} 
 
void to_gregorian ( long julian ) 
	{ 
	int year_greg; 
	int day_greg; 
	int month_greg; 
 
	year_greg = julian / 1000; 
	day_greg = julian % 1000; 
	leap_year ( year_greg ); 
	greg_ ( month_greg, day_greg ); 
	cout << '\n' 
	     << "Gregorian date is :  " 
	     << month_greg << "/" 
	     << day_greg << "/" 
	     << year_greg; 
	} 
 
void to_gregorian 
	( long julian, int& month_greg, int& day_greg, int& year_greg ) 
	{ 
	year_greg = julian / 1000; 
	day_greg = julian % 1000; 
	leap_year ( year_greg ); 
	greg_ ( month_greg, day_greg ); 
	} 
 
long leap_year ( long year, int k ) 
	{ 
	leap_year ( year ); 
	return year *= k; 
	} 
 
void leap_year ( long year ) 
	{ 
	if ( year % 4 == 0 ) 
		days_per_month [ 1 ] = 29; 
	else 
		days_per_month [ 1 ] = 28; 
	if ( year % 100 == 0 && year % 400 != 0 ) 
		days_per_month [ 1 ] = 28; 
	} 
 
int in_month ( ) 
	{ 
	month = 0; 
	while ( month  12 ) 
		{ 
		cout << "Enter month (1 to 12):  "; 
		cin >> month; 
		} 
	return month; 
	} 
int in_day ( int month ) 
	{ 
	day = 0; 
	while ( day  days_per_month [ month - 1 ] ) 
		{ 
		cout << "Enter day (1 to " 
		     << days_per_month [ month - 1 ] << "):  "; 
		cin >> day; 
		} 
	return day; 
	} 
 
int Total_days ( int day, int month_ ) 
	{ 
	int j; 
 
	total_days = day; 
	for ( j = 0; j < month_ - 1; j ++ ) 
		total_days += days_per_month [ j ]; 
	return total_days; 
	} 
 
void greg_ ( int& monthx, int& daysx ) 
	{ 
	monthx = 1; 
	while ( daysx > days_per_month [ monthx - 1 ] ) 
		{ 
		daysx -= days_per_month [ monthx -1 ]; 
		monthx ++; 
		} 
	} 
 
>>> 
--- 
 * OFFLINE 1.58
--- WILDMAIL!/WC v4.12 
---------------
* Origin: Star Tech Diamond Bar, CA 909-396-4227 714-257-1175 (1:218/801.0)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.