作者wowtiger (小虎)
看板C_and_CPP
標題Re: [問題] c語言程式求助
時間Wed Oct 14 00:14:26 2009
※ 引述《yujie609 (yujie)》之銘言:
: 我朋友的作業想請問各位要怎麼做
: 這是他丟給我的問題,我也不清楚是什麼問題
: 所以只能複製貼上給各位看
: 請會的人交交我芭~
: 謝謝。
: 問題:
: 撰寫一個C語言程式, 可以讓使用者輸入他的體重公斤數後,
: 轉換成磅並輸出使用者的體重情形(公斤及磅數)。
: (1磅=0.454公斤)
: (輸出的呈現可自由發揮)
#include <stdio.h>
int main ()
{
const char* xpf = "%f";
const float x454 = 0.454f;
__asm {
push ecx
push ecx
lea ecx, [esp]
push ecx
push xpf
call scanf
pop ecx
pop ecx
fld dword ptr [esp]
fmul x454
fstp qword ptr [esp]
push xpf
call printf
pop ecx
pop ecx
pop ecx
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.44.182.125
→ windincloud:好讚呀~ 有組語了耶~ 10/14 00:17
推 liu2007:too over..... Orz..... 10/14 00:32
推 VictorTom:我就知道會有人這麼搞XD 10/14 00:34
→ softwind:以後貼asm的 可不可以貼 x86 int版本阿... 10/14 00:41
推 nfsnfs:這個太酷了 前面給一點希望 後面就XDDD 10/14 01:26
推 tomnelson:不錯不錯 inline assembly .... 10/14 02:48