`
sjgau
  • 浏览: 95486 次
  • 性别: Icon_minigender_1
  • 来自: 台灣省 台北市
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论
文章列表
http://en.wikipedia.org/wiki/Linear_congruential_generator
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int a, b, c; a= 10; b= a + 1; // b > a printf("\n a= %d, b= %d \n", a, b); system("PAUSE"); // ------------------------------------------ ...
#include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) { int a, b, c; a= 6; b= 7; c= a*b; printf("\n %d X %d --> %d \n", a, b, c); system("PAUSE"); return EXIT_SUCCESS; } ...
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { system("PAUSE"); return 0; }
但是,在程式設計的領域,很容易出現以下的現象。 程式設計的領域是 有限的,數學的領域是 無限的。 這個現象的改善,可以將 int --> double, 但是,問題依然存在。 #if 0 這裡是 以下程式的輸出: x= 10, y= 11 exit the loop, y = x + 1, y <= x, x= 2147483647, y= -2147483648 Press any key to continue #endif // ---------------------------------------------- #incl ...
以下的關於 srand() ,原廠所提供的範例, 可以提供一些有用的資訊。 srand() 是用來設定接下來的 系統所提供的 亂數產生器 所需要的 種子數。 如果不加以設定的話,系統所產生的亂數是固定的, 可以被預測到。 使用 srand(time(NULL)); 之後,系統會抓取現在的時間的秒數, 這個秒數,是從 1970.01.01 的凌晨 00:00:00 到現在所經過的全部 的秒數。 所以,如果在 同一個秒數之內,兩次呼叫 srand(); 所產生的一系列亂數,會完全一樣。 避免的方法是,不要採用 time(NULL); 詳細的想法,容後再稟。 /* RAND.C: ...
我將會有機會代表台灣,到上海開會, 順便參觀世界博覽會。 將這份喜悅,與大家分享! 請參考我的 頭像,就是這幾天照的, AUTOCAD 台灣地區 精英講師群, 不超過 十個,中間穿 藍色上衣的就是 我。 這個活動的網頁,如下: http://brand.autodesk.com.tw/product/autocad/certification/
! VF0944.f90 ! ! FUNCTIONS: ! VF0944 - Entry point of console application. ! ! Example of displaying 'Hello World' at execution time. ! !**************************************************************************** ! ! PROGRAM: VF0944 ! ! PURPOSE: Entry point for 'Hello World ...
/* n1= 50000, n2= 50001, n3= -1794917296 Press any key to continue 上面是 run 出來的結果,如何詳細 正確解釋 上面的現象。不能夠 只是一句 2'補數 就交差了事。 這是我 做學問的態度。 // ---------------------------------------------- 如果你有興趣,請回覆 這個e-mail sjgau4311@gmail.com */ #include <stdio.h> void main() { int n1, ...
精確度可以到 10 ms // file: psc51.cpp // for time1(), time2() #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <math.h> #include <sys/timeb.h> #include <time.h> // ---------------------------------------------- #include "sj01.h" ...
// for skip(), pause() #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <math.h> // ---------------------------------------------- // skip(-3); void skip(int no) { // limits no in 1 .. 20 if ((no >= 1) && (no <= 20)) {// no i ...
#include <stdio.h> void main() { printf("hello, world! at 10:00 -A\n"); }
// unresolved external symbol _main // function should return a value; 'void' return type assumed void main() { }
1/2 要結案,女兒的 科普寫作 Home- Work 標題: 未卜先知-計算機模擬 Computer Simulation 國中的時候,碰到一個很好的數學老師。除了課本的內容之外, 他還會額外的介紹很多跟日常生活有關的數學。 其中,有一項錯誤的介紹,卻影響我很深。他提到過年時候, 街頭巷尾經常看到的賭博遊戲:三顆骰子的押寶遊戲。 老師說,有一種必勝的秘技。第一次押1元,輸了。第二次, 押2元,贏了,就總共獲利至少1元,然後就從頭開始。 輸了,就一直加倍的押下去。 當時年幼無知的我,非常相信他的說法。很可惜,在現實的 生活中,莊家不可能讓你這樣子玩,所以一直無從驗證。 ...
最近,有網友想透過網路跟我學習 AutoLISP 程式設計。 我準備透過 上面的 部落格 從事這項活動。 獨樂樂,不如眾樂樂。 教一個人 和教一堆人,應該是沒有什麼差別。 有興趣的朋友,可以經常前往 上面的網站看看 有問題,有心得,都可以在上面 發言。 我的教學大綱,大概如下 ㄧ AutoCAD 2004 安裝 二 2D + 3D 快速 demo 三 複習 2D 四 AutoLISP 教學 1 "hello, world!\n" 2 註解 ; --- ;| --- --- |; 3 變數之一 x= 4.0*atan(1.0); x= exp(1.0); 變數之 ...
Global site tag (gtag.js) - Google Analytics