[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(DTPtechNote:990) Re: [Release] Q=mm=pt



>¥¤¥ó¥¿¡¼¥Í¥Ã¥È±Û¤·¤À¤ÈÈ¿±þ¤¬°­¤¤¤Î¤Ç¡¢

¤¢¤¡¡¢¤Ê¤à¤Ð¡£¤µ¤ó¤¬¤â¤Ã¤È¥Ï¥ä¡¼¤Ê¥Þ¥·¥ó¤ò¤´Ä󶡤·¤Æ¤¯¤ì¤ì¤Ð¤¤¤Ä¤Ç¤âÈ¿±þ¤¬¤è¤¯¤Ê¤ê¤Þ¤¹¤è(^^;;;;; 
¤½¤ì¤Þ¤Ç¤Ï¤³¤ó¤Ê¤ó¤Ç¤É¤¦¤Ç¤·¤ç¡©

#!/usr/bin/perl
#mm-Q-pointÁê¸ß´¹»»
#¡Êc¡ËShow Ichikawa Copy Right 1999
#	ym3s-ickw@asahi-net.or.jp
#	byi07446@niftyserve.or.jp
#	http://www.asahi-net.or.jp/~ym3s-ickw/showtime.html
#¡üHistory¡¨
#v1.0.0	1999.1.7	¼·Á𴡤⿩¤Ù¤º¤Ëºî¤ê¤Þ¤·¤¿(^_^;  


while (1) {#̵¸Â¥ë¡¼¥×
print "¥ß¥ê¡Êmm¡Ë¡¦¥Ý¥¤¥ó¥È¡Êpt¡Ë¡¦µé¿ô¡ÊQ¡Ë¤òÁê¸ß´¹»»¤·¤Þ¤¹¡£
¿ôÃͤò¡Êñ°Ì¥³¥ß¤Ç¡ËÆþÎϤ·¤Æ¤¯¤À¤µ¤¤¡£
¡Ì½ªÎ»¤¹¤ë»þ¤Ï¡ÖE¡×¤ò¥¿¥¤¥×¤¹¤ë¤«¡¢¥³¥Þ¥ó¥É¡Ü¥Ô¥ê¥ª¥É¤Ç¤¹¡Í?n";
chop($input = <STDIN>);

$ans_mm = $input;
$ans_Q = $input;
$ans_pt = $input;

if ($input =~ /mm|[«¡Ì°®¡]|¥ß¥ê|£í£í/) {	#mmñ°Ì¤¬ÆþÎϤµ¤ì¤¿
$ans_Q =~ s/?D*([?d?.]+)?D*/$1 * 4 . Q/e;
$ans_pt =~ s/?D*([?d?.]+)?D*/&num($1 ?/ 0.352778) . pt/e;

} elsif ($input =~ /[Qµé»õ£Ñ£ñ]/i) {	#µéñ°Ì¤¬ÆþÎϤµ¤ì¤¿
$ans_mm =~ s/?D*([?d?.]+)?D*/$1 ?/ 4 . mm/e;
$ans_pt =~ s/?D*([?d?.]+)?D*/&num($1 ?/ 0.352778 ?/ 4) . pt/e;

} elsif ($input =~ /[p£ð£Ð¥Ý]/i) {	#ptñ°Ì¤¬ÆþÎϤµ¤ì¤¿
$ans_mm =~ s/?D*([?d?.]+)?D*/&num($1 * 0.352778) . mm/e;
$ans_Q =~ s/?D*([?d?.]+)?D*/&num($1 * 0.352778 * 4) . Q/e;

} elsif ($input =~ /[E£Å£å]/i) {	#E¤¬¥¿¥¤¥×¤µ¤ì¤¿
print "¤´ÍøÍѤ¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤·¤¿¡£¤Þ¤¿¤Îµ¯Æ°¤ò¤ªÂÔ¤Á¤·¤Æ¤ª¤ê¤Þ¤¹¡£
--jast 'mm Q pt' service halted--------------------------------?n?n";
last;

} else {	#ͽÁÛ³°¤Î¥¿¥¤¥×
print "¡ª¡ªÆþÎÏ¥¨¥é¡¼¤Ç¤¹¡£¤­¤Á¤ó¤Èñ°Ì¤òÆþÎϤ·¤Þ¤·¤¿¤«¡©?n";
redo;
}

print "¡ÚAnswer¡Û$ans_mm = $ans_Q = $ans_pt?n?n";	#½ÐÎÏ

}#while (1) 


#¢­¾¦¤¬¾®¿ôÅÀ4·å°Ê¾å¤ò´Ý¤á¤ë¥µ¥Ö¥ë¡¼¥Á¥ó
sub num {
local($_) = @_;#°ú¿ô¤ÎÇÛÎó¡Ê@_¡Ë¤ò¥í¡¼¥«¥ë¤Î»²¾È¹Ô¤Ë¤¹¤ë
local(@aa) = split(/?./, $_);#À°¿ôÉô¤È¾®¿ôÉô¤Ëʬ³ä¤·¤Æ¥ê¥¹¥È¤Ë¤¹¤ë
	if (length($aa[1]) > 4) {#¾®¿ôÅÀ¤¬4·å°Ê¾å¤Ê¤é...
		$_ = sprintf("?(Ìó?)%2.4f",$_);#¾®¿ôÅÀ4·å¤Ç´Ý¤á¤ë
	}
$_;#½èÍý·ë²Ì¤òÌ᤹
}