
割圓術到底能不能算出無限位數的 pi π呢......?
首先呢,我們要先知道圓形的一個公式
Here's the formula of a round.
其中, r 是半徑
r is the radius of the round.
運用這個公式,我們可以求得在一個圓形上出現的所有座標
Using this formula, we can get all the positions of the round.但是可想而知,如果圓上面,每個座標都要求到...
其實是有無限多個!
所以,我們就把顯示座標限制在
_____ _____
( √整數 , √整數 )However, the number of the positions on the round...is infinite..So, we just show the positions that are square roots of integers.
_____ _____
( √Integer, √Integer )
finalfrank 發表在 痞客邦 留言(0) 人氣(1,100)

各位鄉親父老......
告訴你們一個不敢面對的真相
那就是.......重灌真的很簡單!!
【圖 1 】 BIOS畫面
請在你「剛開機」的時候,按「DEL」鍵
finalfrank 發表在 痞客邦 留言(2) 人氣(5,526)
本篇教學帶領你「重頭開始」「從無到有」組裝一台電腦
並且讓你對每一個元件有初步的了解
finalfrank 發表在 痞客邦 留言(22) 人氣(113,434)

可以一次計算多個數值的最大公因數 最小公倍數
[ 按此下載 ] [ English Version is Available ]程式碼 (僅供學習參考用) :
#include<stdio.h>
#include<stdlib.h>
int lcm(int a,int b);
int gcd(int c,int d,int e);
int main(void)
{
int g=1,get[10],c,re,re2,re3,gcd2,k;
printf(" 《最大公因數、最小公倍數 計算機》 \n");
while(g=g)
{
while(g==g)
{
printf("\n請輸入第 %d 個數值 ,輸入 0 開始計算: ",g);
scanf("%d",&get[g]);
gcd2=get[g-1];
if(get[g]==0)
break;
g++;
}
g--;
for(k=1;k<=g;k++) /* 排序,從小的數值排到大的 */
{
for(int i=1;i<=g;i++)
{
if(get[k]>get[i])
c=get[k],get[k]=get[i],get[i]=c;
}
}
re=re2=get[g];
while(g>=2)
{
re3=re2;
re=lcm(re,get[g-1]);
re2=lcm(get[g],get[g-1]); /* 計算 這次 最小公倍數 */
re2 = gcd(get[g],get[g-1],re2);
gcd2 = lcm(re2,re3); /* 計算 這次 和 上次 最小公倍數 的 最大公因數 */
gcd2 = gcd(re3,re2,gcd2); /* 計算 這次 和 上次 最小公倍數 的 最小公倍數 */
g--;
}
printf("\n最大公因數 : %d\n\n最小公倍數 : %d\n\n=====================================",re,gcd2);
g=1;
printf("\n\n請輸入第 %d 個數值 ,輸入 0 離開程式: ",g);
scanf("%d",&get[g]),g++;
if(get[1]==0)
{
printf("\n");
break;
}
}
}
int lcm(int a,int b)
{
int c=b;
if(a<b)
c=a,a=b,b=c; /* a b 互換 */
b=a-b;
if(b!=0)
{
while(a%b!=0)
{
c=b;
b=a%b;
a=c;
}
}
else
b=c;
return b;
}
int gcd(int c,int d,int e)
{
e = c * d / e;
return e;
}Code ( for reference only ):
#include<stdio.h>
#include<stdlib.h>
int lcm(int a,int b);
int gcd(int c,int d,int e);
int main(void)
{
int g=1,get[10],c,re,re2,re3,gcd2,k;
printf(" < LCM & GCD CALCULATOR > \n");
while(g=g)
{
while(g==g)
{
printf("\nEnter #%d Value , Enter 0 to begin calculate : ",g);
scanf("%d",&get[g]);
gcd2=get[g-1];
if(get[g]==0)
break;
g++;
}
g--;
for(k=1;k<=g;k++) /* Sort, from small to big */
{
for(int i=1;i<=g;i++)
{
if(get[k]>get[i])
c=get[k],get[k]=get[i],get[i]=c;
}
}
re=re2=get[g];
while(g>=2)
{
re3=re2;
re=lcm(re,get[g-1]);
re2=lcm(get[g],get[g-1]); /* Calculate the lcm this round */
re2 = gcd(get[g],get[g-1],re2);
gcd2 = lcm(re2,re3); /* Calculate the lcm of the gcd of this round and last round */
gcd2 = gcd(re3,re2,gcd2); /* Calculate the gcd of the gcd of this round and last round */
g--;
}
printf("\nL C M : %d\n\nG C D : %d\n\n=====================================",re,gcd2);
g=1;
printf("\n\nEnter #%d Value , Enter 0 to exit : ",g);
scanf("%d",&get[g]),g++;
if(get[1]==0)
{
printf("\n");
break;
}
}
}
int lcm(int a,int b)
{
int c=b;
if(a<b)
c=a,a=b,b=c;
b=a-b;
if(b!=0)
{
while(a%b!=0)
{
c=b;
b=a%b;
a=c;
}
}
else
b=c;
return b;
}
int gcd(int c,int d,int e)
{
e = c * d / e;
return e;
}
finalfrank 發表在 痞客邦 留言(0) 人氣(8,937)

電腦中的顏色系統
The color system of computer.
謹獻給對電腦顏色表示好奇的朋友們
黑白
Black and White
finalfrank 發表在 痞客邦 留言(0) 人氣(2,772)
巴斯卡三角形
Pascal's Triangle
[ 演算程式 ][ Pascal's Triangle Computer ( English Version ) ]
0 1 0 0 0 0 0 1 1 0 0 00 1 2 1 0 00 1 3 3 1 00 1 4 6 4 1計算原理:如上面文字所列 每一格的數值即是( x , y ) ,其中 y 是由上往下數套入公式 ( x , y ) = ( x-1 , y -1 ) + ( x , y-1 ) 使用陣列,馬上就能寫出來Every number existed in the triangle can be expressed like ( x , y ) = ( x - 1 , y -1 ) + ( x , y - 1 )Please notice that the " y " here , is counted from up to down. ( For example : ( 2 , 1 ) = 0 ( 2 , 2 ) = 1 ( 3 , 3 ) = 3 )You can try to write a script to compute this triangle using the formula above. ( It's recommended to use array. )在數學上的應用:Usage of Pascal's Triangle in Mathematics
原始碼 (使用最省記憶、最有效率的寫法)#include<stdio.h>
#include<stdlib.h>
int main ()
{
int phase[34][2],counter,x,row,y;
printf(" 《楊輝三角形產生器》\n\n本程式可以輸出你輸入的列數\n\n任何時候都可以輸入-1離開\n\n(32位元電腦只支援到34行)\n\n ");
while(x==x)/* 無限迴圈開始 */
{
for(x=0;x<=34;x++) /* 清空變數 */
{
for(y=0;y<=1;y++)
phase[x][y]=0;
}
printf("請輸入顯示列數 : ");
scanf("%d",&counter);
printf("\n");
if(counter>=35)
counter=34;
if(counter==-1) /* 使用者輸入 -1 離開 */
break;
phase[0][0]=1; /* 初始化計算用數值 */
row=1;
while(row<=counter) /* 程式跑到指定列數才結束 */
{
for(x=1;x<=counter-row;x++) /* 美化用的迴圈... */
printf(" ");
for(x=1;x<=row;x++) /* 計算並顯示數值 */
{
phase[x][1]=phase[x-1][0]+phase[x][0];
printf(" %d",phase[x][1]);
}
for(x=0;x<=row;x++) /* 放入這個迴圈的數值 讓下個迴圈計算 */
phase[x][0]=phase[x][1];
row++; /* 跑的列數 +1 */
printf("\n\n");
}
} /* 無限迴圈結束 */
printf("(c) NTPU CSIE 49571602\n\n");
system("pause");
return 0;
} Pascal's Triangle Code. ( White Texts Hidden Below, for your reference. ) (Using the most efficient method, which saves most memory that I've ever tried.)#include<stdio.h>
#include<stdlib.h>
int main ()
{
int phase[34][2],counter,x,row,y;
printf(" << Pascal's Triangle Computer >>\n\nThis program computes the number of line you requested.\n\nYou may exit any time by typing -1\n\n( A 32-bit computer is limited to display less than 34 lines. )\n\n ");
while(x==x)
{
for(x=0;x<=34;x++)
{
for(y=0;y<=1;y++)
phase[x][y]=0;
}
printf("For How many Lines would you like to Compute : ");
scanf("%d",&counter);
printf("\n");
if(counter>=35)
counter=34;
if(counter==-1)
break;
phase[0][0]=1;
row=1;
while(row<=counter)
{
for(x=1;x<=counter-row;x++)
printf(" ");
for(x=1;x<=row;x++) /* 計算並顯示數值 */
{
phase[x][1]=phase[x-1][0]+phase[x][0];
printf(" %d",phase[x][1]);
}
for(x=0;x<=row;x++)
phase[x][0]=phase[x][1];
row++;
printf("\n\n");
}
}
printf("(c) NTPU CSIE 49571602\n\n");
system("pause");
return 0;
}
finalfrank 發表在 痞客邦 留言(0) 人氣(4,109)

這是一個RPG戰鬥系統的流程圖,提供讓想寫自戰的玩家使用
如果想要改成半即時制或即時制的戰鬥系統,只要更改角色輪流系統即可
This is a flow chart of a battle system in R.P.G. games for new game developers' reference.
If you want to make it a real-time battle system, all you have do is to change the "dice".
finalfrank 發表在 痞客邦 留言(4) 人氣(9,327)

有時候要更改HTML原始碼最常動到的地方就是框架頁
可惜的是這部分是最多人不會注意的部分
而且,有些網頁設計軟體在這方面的操作效果,實在是不如直接編寫原始碼
所以特別在這邊寫一下
finalfrank 發表在 痞客邦 留言(2) 人氣(51,871)

這就是傳說中的星座計算機,小巧好用方便攜帶
你可以把他放在你的隨身碟
這樣就可以到處幫別人看星座啦!
[ 把我帶回家 ]
Code:(老樣子,反白看。寫太爛也麻煩糾正!)
finalfrank 發表在 痞客邦 留言(0) 人氣(418)

這其實是幼教軟體(!?) (沒辦法,一堆人跟我說這不知道能幹嘛XD!!)
丟一個 六位數以下 的阿拉伯數字 進去
[修正上圖第三個指令的結果錯誤]會跑出中文的唸法
[ 下載來玩 ]想要看程式碼的,麻煩把下面反白 XD
( 寫得太爛記得通知一聲 m(_ _)m )
#include<stdio.h>
#include<conio.h>
int main()
{
int a,b,c,d,last;
printf("請輸入一個六位以下的數字,電腦會幫你轉成中文\n\n請輸入數字:");
scanf("%d",&a);
start:
last=0;
d=100000;
printf("\n數字中文寫法:");
for(c=1;c<=6;c++)
{
if(c==1) b=a/d;
if(c>=2) a=a%d,d=d/10,b=a/d;
if(c==5&&a==0||c==3&&a==0) break;
if(c==4&&a%1000==0) break;
if(b==1)
{ if(c!=1&&c!=5) printf("一",b);
if(c==5&&last!=0) printf("一");
}
if(b==2) printf("二");
if(b==3) printf("三");
if(b==4) printf("四");
if(b==5) printf("五");
if(b==6) printf("六");
if(b==7) printf("七");
if(b==8) printf("八");
if(b==9) printf("九");
if(b!=0)
{
if(c==1) printf("十"),last=last+=b;
if(c==2) printf("萬");
if(c==3) printf("千");
if(c==4) printf("百");
if(c==5) printf("十");
}
else
{
if(c==2&&last>0) printf("萬");
if(c>=3&&c<=5&&last!=0) printf(".零");
}
last=b;
}
printf("\n\n輸入下一個數字,或輸入「-1」結束 : ");
scanf("%d",&a);
if(a!=-1)
goto start;
printf("Bye bye~~~!!");
getch();
return 0;
}
finalfrank 發表在 痞客邦 留言(0) 人氣(1,325)