當前位置:首頁 » 編程軟體 » 編程經典

編程經典

發布時間: 2022-06-29 03:25:32

1. 編程書籍經典的有哪些

演算法/數據結構/底層理論:
《演算法導論》:學習演算法的必讀書,也應作為程序員 」基本素養「 看一看
《計算機程序設計藝術》:一部仍未完成的著作,作者高德納因此獲得美國計算機協會 1974 年圖靈獎 - wikipedia:計算機程序設計藝術
《數據結構與演算法分析》
《具體數學》
編譯原理》:編譯理論的 」龍書「
《深入理解計算機系統》
編程語言/工具等:
《C 程序設計語言》:C 語言發明者之一 Dennis 的經典 C 語言教程
《C++ Primer》
java 編程思想》
《OpenGL 編程指南》:」紅寶書「
php 和 Mysql Web 開發》:不要看目前的中文版
軟體工程/開發
《設計模式》
《人月神話》:被譽為軟體工程領域的聖經 - wikipedia:人月神話
《重構》
《代碼大全》
《程序員修煉之道》:如何 」編程「?

2. java編程經典書籍有哪些

以下詳細介紹了如何學習Java,如果樓主有耐心的話,建議仔細看一下~

學習一門新的知識,不可能指望只看一本,或者兩本書就能夠完全掌握。需要有一個循序漸進的閱讀過程。我推薦Oreilly出版的Java系列書籍。

在這里我只想補充一點看法,很多人學習Java是從《Thinking in Java》這本書入手的,但是我認為這本書是不適合初學者的。我認為正確的使用這本書的方法應該是作為輔助的讀物。《Thinking in Java》並不是在完整的介紹Java的整個體系,而是一種跳躍式的寫作方法,是一種類似tips的方法來對Java很多知識點進行了深入的分析和解釋。

對於初學者來說,最好是找一本Java入門的書籍,但是比較完整的循序的介紹Java的語法,面向對象的特性,核心類庫等等,在看這本書的同時,可以同步來看《Thinking in Java》,來加深對Java的理解和原理的運用,同時又可以完整的了解Java的整個體系。

對於Java的入門書籍,蔡學鏞推薦的是Oreilly的《Exploring Java, 2nd Edition》 或者《Java in a Nutshell,2nd Edition(針對C++背景)》,我並沒有看過這兩本書。其實我覺得電子工業出版社的《Java 2編程詳解》或者《Java 2從入門到精通》就很不錯。

在所有的Java書籍當中,其實最最有用的,並不是O'reilly的 Java Serials,真正最最有用處是JDK的Documentation!幾乎你想獲得的所有的知識在Documentation裡面全部都有,其中最主要的部分當然是Java基礎類庫的API文檔,是按照package來組織的,對於每一個class都有詳細的解釋,它的繼承關系,是否實現了某個介面,通常用在哪些場合,還可以查到它所有的public的屬性和方法,每個屬性的解釋,意義,每個方法的用途,調用的參數,參數的意義,返回值的類型,以及方法可能拋出的異常等等。可以這樣來說,所有關於Java編程方面的書籍其實都不過是在用比較通俗易懂的語言,和良好的組織方式來介紹Documentation裡面的某個package裡麵包含的一些類的用法而已。所以萬變不離其宗,如果你有足夠的能力來直接通過Documentation來學習Java的類庫,那麼基本上就不需要看其他的書籍了。除此之外,Documentation也是編程必備的手冊,我的桌面上有三個Documentation的快捷方式,分別是J2SDK1.4.1的Documentation,Servlet2.3的Documentation和J2SDKEE1.3.1的Documentation。有了這個三個Documentation,什麼其他的書籍都不需要了。

對於Java Web 編程來說,最核心的是要熟悉和掌握HTTP協議,這個就和Java無關了,在熟悉HTTP協議之後,就需要熟悉Java的實現HTTP協議的類庫,也就是Servlet API,所以最重要的東西就是Servlet API。當然對於初學者而言,直接通過Servlet API來學習Web編程有很大的難度,我推薦O'reilly的《Java Server Pages 》這本書來學習Web 編程。

EJB的書籍當中,《Enterprise JavaBeans, 2nd Edition》是一本很不錯的書, EJB的學習門檻是比較高,入門很難,但是這本書完全降低了學習的難度,特別重要的一點是,EJB的學習需要結合一種App Server的具體實現,所以在學習EJB的同時,必須同步的學習某種App Server,而這本書相關的出了三本書,分別是Weblogic6.1,Websphere4.0和JBoss3.0上面部署書中例子的實做。真是既有理論,又有實踐。在學習EJB的同時,可以邊看邊做,EJB的學習會變得很輕松。

但是這本書也有一個問題,就是版本比較舊,主要講EJB1.1規范和部分EJB2.0的規范。而Ed Roman寫的《Mastering EJB 2.0》這本書完全是根據EJB2.0規范寫的,深入淺出,覆蓋了EJB編程的各個方面,並且還有很多編程經驗tips,也是學習EJB非常推薦的書籍之一。

如果是結合Weblogic來學習J2EE的話,《J2EE應用與BEA Weblogic Server》絕對是首選讀物,雖然是講述的Weblogic6.0,仍然值得購買,這本書是BEA官方推薦的教材,作者也是BEA公司的工程師。現在中文版已經隨處可見了。這本書結合Weblogic介紹了J2EE各個方面的技術在Weblogic平台上的開發和部署,實踐指導意義非常強。

在掌握了Java平台基礎知識和J2EE方面的知識以後,更進一步的是學習如何運用OO的方法進行軟體的設計,那麼就一定要學習「設計模式」。Sun公司出版了一本《J2EE核心模式》,是每個開發Java企業平台軟體的架構師必備的書籍。這本書全面的介紹了J2EE體系架構的各種設計模式,是設計師的必讀書籍。

Java Learning Path(三)過程篇

每個人的學習方法是不同的,一個人的方法不見得適合另一個人,我只能是談自己的學習方法。因為我學習Java是完全自學的,從來沒有問過別人,所以學習的過程基本上完全是自己摸索出來的。我也不知道這種方法是否是比較好的方法,只能給大家提供一點參考了。

學習Java的第一步是安裝好JDK,寫一個Hello World, 其實JDK的學習沒有那麼簡單,關於JDK有兩個問題是很容易一直困擾Java程序員的地方:一個是CLASSPATH的問題,其實從原理上來說,是要搞清楚JRE的ClassLoader是如何載入Class的;另一個問題是package和import問題,如何來尋找類的路徑問題。把這兩個問題摸索清楚了,就掃除了學習Java和使用JDK的最大障礙。推薦看一下王森的《Java深度歷險》,對這兩個問題進行了深入的探討。

第二步是學習Java的語法。Java的語法是類C++的,基本上主流的編程語言不是類C,就是類C++的,沒有什麼新東西,所以語法的學習,大概就是半天的時間足夠了。唯一需要注意的是有幾個不容易搞清楚的關鍵字的用法,public,protected,private,static,什麼時候用,為什麼要用,怎麼用,這可能需要有人來指點一下,我當初是完全自己琢磨出來的,花了很久的時間。不過後來我看到《Thinking in Java》這本書上面是講了這些概念的。

第三步是學習Java的面向對象的編程語言的特性的地方。比如繼承,構造器,抽象類,介面,方法的多態,重載,覆蓋,Java的異常處理機制。對於一個沒有面向對象語言背景的人來說,我覺得這個過程需要花很長很長時間,因為學習Java之前沒有C++的經驗,只有C的經驗,我是大概花了一個月左右吧,才徹底把這些概念都搞清楚,把書上面的例子反復的揣摩,修改,嘗試,把那幾章內容反復的看過來,看過去,看了不下5遍,才徹底領悟了。不過我想如果有C++經驗的話,應該一兩天時間足夠了。那麼在這個過程中,可以多看看《Thinking in Java》這本書,對面向對象的講解非常透徹。可惜的是我學習的時候,並沒有看到這本書,所以自己花了大量的時間,通過自己的嘗試和揣摩來學會的。

第四步就是開始熟悉Java的類庫。Java的基礎類庫其實就是JDK安裝目錄下面jre\lib\rt.jar這個包。學習基礎類庫就是學習rt.jar。基礎類庫裡面的類非常非常多。據說有3000多個,我沒有統計過。但是真正對於我們來說最核心的只有4個,分別是
java.lang.*;
java.io.*;
java.util.*;
java.sql.*;

這四個包的學習,每個包的學習都可以寫成一本厚厚的教材,而O'reilly也確實是這樣做的。我覺得如果時間比較緊,是不可能通過讀四本書來學習。我覺得比較好的學習方法是這樣的:
首先要通讀整個package的框架,了解整個package的class,interface,exception的構成,最好是能夠找到介紹整個包框架的文章。這些專門介紹包的書籍的前幾章應該就是這些總體的框架內容介紹。

對包整體框架的把握並不是要熟悉每個類的用法,記住它有哪些屬性,方法。想記也記不住的。而是要知道包有哪些方面的類構成的,這些類的用途是什麼,最核心的幾個類分別是完成什麼功能的。我在給人培訓的時候一般是一次課講一個包,所以不可能詳細的介紹每個類的用法,但是我反復強調,我給你們講這些包的不是要告訴你們類的方法是怎麼調用的,也不要求你們記住類的方法調用,而是要你們了解,Java給我們提供了哪些類,每個類是用在什麼場合,當我遇到問題的時候,我知道哪個類,或者哪幾個類的組合可以解決我的問題,That'all!,當我們具體寫程序的時候,只要你知道該用哪個類來完成你的工作就足夠了。編碼的時候,具體的方法調用,是邊寫代碼,邊查Documentation,所有的東西都在Documentation裡面,不要求你一定記住,實際你也記不住3000多個類的總共將近10萬個方法調用。所以對每個包的總體框架的把握就變得極為重要。

第五步,通過上面的學習,如果學的比較扎實的話,就打好了Java的基礎了,剩下要做的工作是掃清Documentation裡面除了上面4個包之外的其他一些比較有用處的類。相信進展到這一步,Java的自學能力已經被培養出來了,可以到了直接學習Documentation的水平了。除了要做GUI編程之外,JDK裡面其他會有用處的包是這些:
java.text.*;
java.net.*;
javax.naming.*;
這些包裡面真正用的比較多的類其實很少,只有幾個,所以不需要花很多時間。

第六步,Java Web 編程
Web編程的核心是HTTP協議,HTTP協議和Java無關,如果不熟悉HTTP協議的話,雖然也可以學好Servlet/JSP編程,但是達不到舉一反三,一通百通的境界。所以HTTP協議的學習是必備的。如果熟悉了HTTP協議的話,又有了Java編程的良好的基礎,學習Servlet/JSP簡直易如反掌,我學習Servlet/JSP就用了不到一周的時間,然後就開始用JSP來做項目了。

在Servlet/JSP的學習中,重頭仍然是Servlet Documentation。Servlet API最常用的類很少,花比較少的時間就可以掌握了。把這些類都看一遍,多寫幾個例子試試。Servlet/JSP編程本質就是在反復調用這些類來通過HTTP協議在Web Server和Brower之間交談。另外對JSP,還需要熟悉幾個常用JSP的標記,具體的寫法記不住的話,臨時查就是了。

此外Java Web編程學習的重點要放在Web Application的設計模式上,如何進行業務邏輯的分析,並且進行合理的設計,按照MVC設計模式的要求,運用Servlet和JSP分別完成不同的邏輯層,掌握如何在Servlet和JSP之間進行流程的控制和數據的共享,以及Web Application應該如何配置和部署。

第七步,J2EE編程
以上的學習過程如果是比較順利的話,進行到這一步,難度又陡然提高。因為上面的知識內容都是只涉及一個方面,而像EJB,JMS,JTA等核心的J2EE規范往往是幾種Java技術的綜合運用的結晶,所以掌握起來難度比較大。

首先一定要學習好JNDI,JNDI是App Server定位伺服器資源(EJB組件,Datasouce,JMS)查找方法,如果對JNDI不熟悉的話,EJB,JMS這些東西幾乎學不下去。JNDI其實就是javax.naming.*這個包,運用起來很簡單。難點在於伺服器資源文件的配置。對於伺服器資源文件的配置,就需要看看專門的文檔規范了,比如web.xml的寫法,ejb-jar.xml的寫法等等。針對每種不同的App Server,還有自己的服務資源配置文件,也是需要熟悉的。

然後可以學習JTA,主要是要理解JTA對於事務的控制的方法,以及該在什麼場合使用JTA。這里可以簡單的舉個例子,我們知道一般情況可以對於一個資料庫連接進行事務控制(conn.setAutoCommit(false),....,conn.commit()),做為一個原子操作,但是假設我的業務需求是要把對兩個不同資料庫的操作做為一個原子操作,你能做的到嗎?這時候只能用JTA了。假設操作過程是先往A資料庫插一條記錄,然後刪除B資料庫另一個記錄,我們自己寫代碼是控制不了把整個操作做為一個原子操作的。用JTA的話,由App Server來完成控制。

在學習EJB之前要學習對象序列化和RMI,RMI是EJB的基礎。接著學習JMS和EJB,對於EJB來說,最關鍵是要理解EJB是如何通過RMI來實現對遠端對象的調用的,以及在什麼情況下要用到EJB。

在學習完EJB,JMS這些東西之後,你可能會意識到要急不可待學習兩個領域的知識,一個是UML,另一個是Design Pattern。Java企業軟體的設計非常重視框架(Framework)的設計,一個好的軟體框架是軟體開發成功的必要條件。在這個時候,應該開始把學習的重點放在設計模式和框架的學習上,通過學習和實際的編程經驗來掌握EJB的設計模式和J2EE的核心模式。

J2EE規范裡面,除了EJB,JMS,JTA,Servlet/JSP,JDBC之外還有很多很多的企業技術,這里不一一進行介紹了。

另外還有一個最新領域Web Services。Web Services也完全沒有任何新東西,它像是一種黏合劑,可以把不同的服務統一起來提供一個統一的調用介面,作為使用者來說,我只要獲得服務提供者給我的WSDL(對服務的描述),就夠了,我完全不知道伺服器提供者提供的服務究竟是EJB組件,還是.Net組件,還是什麼CORBA組件,還是其他的什麼實現,我也不需要知道。Web Services最偉大的地方就在於通過統一的服務提供方式和調用方式,實現了整個Internet服務的共享,是一個非常令人激動的技術領域。Web Services好像目前還沒有什麼很好的書籍,但是可以通過在網路上面查資料的方式來學習。

Java Learning Path(四) 方法篇

Java作為一門編程語言,最好的學習方法就是寫代碼。當你學習一個類以後,你就可以自己寫個簡單的例子程序來運行一下,看看有什麼結果,然後再多調用幾個類的方法,看看運行結果,這樣非常直觀的把類給學會了,而且記憶非常深刻。然後不應該滿足把代碼調通,你應該想想看如果我不這樣寫,換個方式,再試試行不行。記得哪個高人說過學習編程就是個破壞的過程,把書上的例子,自己學習Documentation編寫的例子在運行通過以後,不斷的嘗試著用不同的方法實現,不斷的嘗試破壞代碼的結構,看看它會有什麼結果。通過這樣的方式,你會很徹底的很精通的掌握Java。

舉個例子,我們都編過Hello World

public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}

很多初學者不是很理解為什麼main方法一定要這樣來定義public static void main(String[] args),能不能不這樣寫?包括我剛學習Java的時候也有這樣的疑問。想知道答案嗎?很簡單,你把main改個名字運行一下,看看報什麼錯誤,然後根據出錯信息進行分析;把main的public取掉,在試試看,報什麼錯誤;static去掉還能不能運行;不知道main方法是否一定要傳一個String[]數組的,把String[]改掉,改成int[],或者String試試看;不知道是否必須寫args參數名稱的,也可以把args改成別的名字,看看運行結果如何。

我當初學習Java的時候就是這樣做的,把Hello World程序反復改了七八次,不斷運行,分析運行結果,最後就徹底明白為什麼了main方法是這樣定義的了。

此外,我對於staic,public,private,Exception,try{ }catch {}finally{}等等等等一開始都不是很懂,都是把參考書上面的例子運行成功,然後就開始破壞它,不斷的根據自己心裏面的疑問來重新改寫程序,看看能不能運行,運行出來是個什麼樣子,是否可以得到預期的結果。這樣雖然比較費時間,不過一個例子程序這樣反復破壞幾次之後。我就對這個相關的知識徹底學通了。有時候甚至故意寫一些錯誤的代碼來運行,看看能否得到預期的運行錯誤。這樣對於編程的掌握是及其深刻的。

其中特別值得一提的是JDK有一個非常棒的調試功能,-verbose
java –verbose
javac –verbose 以及其它很多JDK工具都有這個選項
-verbose 可以顯示在命令執行的過程中,JVM都依次載入哪裡Class,通過這些寶貴的調試信息,可以幫助我們分析出JVM在執行的過程中都幹了些什麼。

另外,自己在學習過程中,寫的很多的這種破壞常式,應該有意識的分門別類的保存下來,在工作中積累的典型常式也應該定期整理,日積月累,自己就有了一個代碼庫了。遇到類似的問題,到代碼庫裡面 Copy & Paste ,Search & Replace,就好了,極大提高了開發速度。最理想的情況是把一些通用的常式自己再抽象一層,形成一個通用的類庫,封裝好。那麼可復用性就更強了。

所以我覺得其實不是特別需要常式的,自己寫的破壞常式就是最好的例子,如果你實在對自己寫的代碼不放心的話,我強烈推薦你看看JDK基礎類庫的Java源代碼。在JDK安裝目錄下面會有一個src.zip,解開來就可以完整的看到整個JDK基礎類庫,也就是rt.jar的Java源代碼,你可以參考一下Sun是怎麼寫Java程序的,規范是什麼樣子的。我自己在學習Java的類庫的時候,當有些地方理解的不是很清楚的時候,或者想更加清晰的理解運作的細節的時候,往往會打開相應的類的源代碼,通過看源代碼,所有的問題都會一掃而空。

Java Learning Path(五)資源篇

1、 http://java.sun.com/ (英文)
Sun的Java網站,是一個應該經常去看的地方。不用多說。

2、http://www-900.ibm.com/developerWorks/cn/
IBM的developerWorks網站,英語好的直接去英文主站點看。這里不但是一個極好的面向對象的分析設計網站,也是Web Services,Java,Linux極好的網站。強烈推薦!!!

3、http://www.javaworld.com/ (英文)
關於Java很多新技術的討論和新聞。想多了解Java的方方面面的應用,這里比較好。

4、http://dev2dev.bea.com.cn/index.jsp
BEA的開發者園地,BEA作為最重要的App Server廠商,有很多獨到的技術,在Weblogic上做開發的朋友不容錯過。

5、http://www.huihoo.com/
灰狐動力網站,一個專業的中間件網站,雖然不是專業的Java網站,但是在J2EE企業應用技術方面有深厚的造詣。

6、http://www.theserverside.com/home/ (英文)
TheServerSide是一個著名的專門面向Java Server端應用的網站。

7、http://www.javaresearch.org/
Java研究組織,有很多優秀的Java方面的文章和教程,特別是在JDO方面的文章比較豐富。

8、http://www.cnjsp.org/
JSP技術網站,有相當多的Java方面的文章和資源。

9、http://www.jdon.com/
Jdon論壇,是一個個人性質的中文J2EE專業技術論壇,在眾多的Java的中文論壇中,Jdon一個是技術含量非常高,帖子質量非常好的論壇。

10、http://sourceforge.net/
SourgeForge是一個開放源代碼軟體的大本營,其中也有非常非常豐富的Java的開放源代碼的著名的軟體。

參考資料:http://www.itpub.net/showthread.php?threadid=159803&pagenumber=
參考資料:http://..com/question/751730.html

3. 最經典計算機編程語言是什麼

等問題。當我毫不猶豫的回答,C是最經典的最實用的計算機編程語言時他們大都愣住了。為什麼不是ASM/JAVA/C++/PASCAL/LISP/C#/VB/VB.NET等這些更高級更優秀的編程語言呢? 他們的困惑我能理解。開學第一天老師就給他們發了 The High Level Language C 的英文原版教材,卻沒有介紹為什麼學校要採用這一本教材,而且還是英文原版的,C的成功之處是什麼,學了C語言能夠做什麼,C的前景和現狀是什麼,更重要的是C的未來發展前景怎樣呢等等,這一切的一切教師們未曾提起。即使有先見的人去問了,得到結果也只是你自己去了解 吧!他們的課程就是從Hello, world開始的,帶著一頭霧氣。 #include <stdio.h int main(){ printf(Hello, world ! /n);return 0;}然後,進行編譯運行而已。因為這個沒什麼可講的,實在體簡單了。老師的授課讓我們感到很遺憾的。一群渴望學習的孩子就被這樣殺戮了。我們的教育制度實在很讓人憂慮了。多數的教師都擁有很多的職稱但是稱職卻寥寥無幾了。 填鴨式 教育隨處可見。甚至我現在一些老師還是停留在這種層次上面。由此可見,昨日的象牙塔不再光彩照人了。家長、社會都在發問,為什麼? 實在讓人費解我們的狀況還是這樣糟糕。有人認為對於學計算機專業做軟體開發的人來說學一門語言(至少是這樣)是很重要的。工具自然不是軟體科學的核心但是對於語言學習還是很重要,只有通過語言才能和計算機進行交流,才得以表達自己的思想。所以我們的問題產生了。但是為什麼C語言才是最經典的語言呢?這足以讓人吃驚了,尤其對那些不太了解或者還沒有接觸過C語言的朋友(打面向對象的編程語言的出現,給計算機,尤其是軟體事業的發展得來了一個新的時代,新的革命。好多人從生產實踐中發現了面向對象的編程語言的優點和實用性、高效性、好維護性、清晰性等。所以,我多人都去學面向對象的語言去了。才會產生這樣的誤解,以為C就那麼煩瑣那麼低效)。C是一門很優秀的編程語言,其結構化很好,而且用其編寫的程序的運行速度還是足夠快的,佔用內存也很少(略高於相同功能的匯編語言程序),這是其他面向對象的高級語言無法比擬的。C是一門高級的低級語言。它有很好的體系和嚴格的語法以及相應的編程規范。它比匯語言更容易操作,但是不及高級語言那麼簡單。大概因為C語言里的bug很難發現和更正,所以好多人只是望而生畏罷了。因為她有缺點,所以才喜歡她 !。也許我不同於許多朋友之處就在於此吧。 我喜歡C語言,而且還認為她是最好的一門編程語言。 C的好處還在於我們能夠操作程序的每一個細節,讓整個程序按照我們的思路來執行。可以直接的操作內存,來避免不必要的錯誤的產生等。其實,C語言的優秀之處是有目共睹的,你的電腦操作系統,不管是Windows還是Linux或者Unix其內核都是用C來實現的,高級語言最多也就是用於開發一些應用軟體罷了。尤其是在嵌入式軟體開發中C表現的更加出色。當然了,這還與你的硬體環境,比如,內存的大小,和軟體的應用的領域等等有很大的一層關系。 雖然,包括微軟等公司和個人都在盡一切的可能來開發基於高級語言的操作系統,比如微軟longhorn,來說明高級語言的高效、健壯等特性,但是我們還沒有見到最後的結果。現在言論實在太早了。匯編語言很不錯,但是能夠把握匯編語言的人實在太少了。因為它結構很混亂,邏輯很差等。 我相信,總有一天大家都會發現只有C才是最經典的計算機編程語言。我希望那些想通過學習一門優秀的語言來了解和把握計算機科學的同學朋友們盡早的改變自己的錯誤的觀念。語言只是一種工具,最重要的還是計算機理論知識。這是沒有一門語言足夠表達的。領域知識的積累對一個人的職業生涯起著一個決定性的作用。

4. C語言的經典編程例子

//最經典的當然是HelloWorld了。
#include"stdio.h"
intmain(void)
{
printf("HelloWorld! ");
}

5. 有哪些和編程有關的經典語句

  1. One man's constant is another man's variable.

  2. Functions delay binding: data structures ince binding. Moral: Structure data late in the programming process.

  3. Syntactic sugar causes cancer of the semi-colons.

  4. Every program is a part of some other program and rarely fits.

  5. If a program manipulates a large amount of data, it does so in a small number of ways.

  6. Symmetry is a complexity recing concept (co-routines include sub-routines); seek it everywhere.

  7. It is easier to write an incorrect program than understand a correct one.

  8. A programming language is low level when its programs require attention to the irrelevant.

  9. It is better to have 100 functions operate on one data structure than 10 functions on 10 data structures.

  10. Get
    into a rut early: Do the same processes the same way. Accumulate
    idioms. Standardize. The only difference (!) between Shakespeare and you
    was the size of his idiom list - not the size of his vocabulary.

  11. If you have a procere with 10 parameters, you probably missed some.

  12. Recursion is the root of computation since it trades description for time.

  13. If two people write exactly the same program, each should be put in micro-code and then they certainly won't be the same.

  14. In the long run every program becomes rococo - then rubble.

  15. Everything should be built top-down, except the first time.

  16. Every program has (at least) two purposes: the one for which it was written and another for which it wasn't.

  17. If a listener nods his head when you're explaining your program, wake him up.

  18. A program without a loop and a structured variable isn't worth writing.

  19. A language that doesn't affect the way you think about programming, is not worth knowing.

  20. Wherever
    there is molarity there is the potential for misunderstanding: Hiding
    information implies a need to check communication.

  21. Optimization hinders evolution.

  22. A good system can't have a weak command language.

  23. To understand a program you must become both the machine and the program.

  24. Perhaps if we wrote programs from childhood on, as alts we'd be able to read them.

  25. One
    can only display complex information in the mind. Like seeing, movement
    or flow or alteration of view is more important than the static
    picture, no matter how lovely.

  26. There will always be things we wish to say in our programs that in all known languages can only be said poorly.

  27. Once you understand how to write a program get someone else to write it.

  28. Around
    computers it is difficult to find the correct unit of time to measure
    progress. Some cathedrals took a century to complete. Can you imagine
    the grandeur and scope of a program that would take as long?

  29. For
    systems, the analogue of a face-lift is to add to the control graph an
    edge that creates a cycle, not just an additional node.

  30. In programming, everything we do is a special case of something more general - and often we know it too quickly.

  31. Simplicity does not precede complexity, but follows it.

  32. Programmers are not to be measured by their ingenuity and their logic but by the completeness of their case analysis.

  33. The 11th commandment was "Thou Shalt Compute" or "Thou Shalt Not Compute" - I forget which.

  34. The
    string is a stark data structure and everywhere it is passed there is
    much plication of process. It is a perfect vehicle for hiding
    information.

  35. Everyone can be taught to sculpt: Michelangelo would have had to be taught how not to. So it is with the great programmers.

  36. The
    use of a program to prove the 4-color theorem will not change
    mathematics - it merely demonstrates that the theorem, a challenge for a
    century, is probably not important to mathematics.

  37. The
    most important computer is the one that rages in our skulls and ever
    seeks that satisfactory external emulator. The standardization of real
    computers would be a disaster - and so it probably won't happen.

  38. Structured Programming supports the law of the excluded muddle.

  39. Re
    graphics: A picture is worth 10K words - but only those to describe the
    picture. Hardly any sets of 10K words can be adequately described with
    pictures.

  40. There are two ways to write error-free programs; only the third one works.

  41. Some programming languages manage to absorb change, but withstand progress.

  42. You can measure a programmer's perspective by noting his attitude on the continuing vitality of FORTRAN.

  43. In software systems it is often the early bird that makes the worm.

  44. Sometimes I think the only universal in the computing field is the fetch-execute-cycle.

  45. The goal of computation is the emulation of our synthetic abilities, not the understanding of our analytic ones.

  46. Like punning, programming is a play on words.

  47. As Will Rogers would have said, "There is no such thing as a free variable."

  48. The
    best book on programming for the layman is "Alice in Wonderland"; but
    that's because it's the best book on anything for the layman.

  49. Giving
    up on assembly language was the apple in our Garden of Eden: Languages
    whose use squanders machine cycles are sinful. The LISP machine now
    permits LISP programmers to abandon bra and fig-leaf.

  50. When we understand knowledge-based systems, it will be as before - except our finger-tips will have been singed.

  51. Bringing computers into the home won't change either one, but may revitalize the corner saloon.

  52. Systems have sub-systems and sub-systems have sub-systems and so on ad infinitum - which is why we're always starting over.

  53. So many good ideas are never heard from again once they embark in a voyage on the semantic gulf.

  54. Beware of the Turing tar-pit in which everything is possible but nothing of interest is easy.

  55. A LISP programmer knows the value of everything, but the cost of nothing.

  56. Software is under a constant tension. Being symbolic it is arbitrarily perfectible; but also it is arbitrarily changeable.

  57. It is easier to change the specification to fit the program than vice versa.

  58. Fools ignore complexity. Pragmatists suffer it. Some can avoid it. Geniuses remove it.

  59. In English every word can be verbed. Would that it were so in our programming languages.

  60. Dana Scott is the Church of the Lattice-Way Saints.

  61. In programming, as in everything else, to be in error is to be reborn.

  62. In computing, invariants are ephemeral.

  63. When we write programs that "learn", it turns out we do and they don't.

  64. Often it is means that justify ends: Goals advance technique and technique survives even when goal structures crumble.

  65. Make
    no mistake about it: Computers process numbers - not symbols. We
    measure our understanding (and control) by the extent to which we can
    arithmetize an activity.

  66. Making something variable is easy. Controlling ration of constancy is the trick.

  67. Think of all the psychic energy expended in seeking a fundamental distinction between "algorithm" and "program".

  68. If
    we believe in data structures, we must believe in independent (hence
    simultaneous) processing. For why else would we collect items within a
    structure? Why do we tolerate languages that give us the one without the
    other?

  69. In a 5 year period we get one superb programming language. Only we can't control when the 5 year period will begin.

  70. Over
    the centuries the Indians developed sign language for communicating
    phenomena of interest. Programmers from different tribes (FORTRAN, LISP,
    ALGOL, SNOBOL, etc.) could use one that doesn't require them to carry a
    blackboard on their ponies.

  71. Documentation is like term insurance: It satisfies because almost no one who subscribes to it depends on its benefits.

  72. An adequate bootstrap is a contradiction in terms.

  73. It
    is not a language's weaknesses but its strengths that control the
    gradient of its change: Alas, a language never escapes its embryonic
    sac.

  74. It is possible that software is not like anything
    else, that it is meant to be discarded: that the whole point is to
    always see it as soap bubble?

  75. Because of its vitality, the computing field is always in desperate need of new cliches: Banality soothes our nerves.

  76. It is the user who should parameterize proceres, not their creators.

  77. The
    cybernetic exchange between man, computer and algorithm is like a game
    of musical chairs: The frantic search for balance always leaves one of
    the three standing ill at ease.

6. java經典編程案例有哪些

  1. java編程的記事本:

    import java.util.*;
    public class JieChengExample
    {
    public static void main(String args[])
    {
    Scanner input=new Scanner(System.in);
    int n,sum;
    Jiecheng jie=new Jiecheng();
    System.out.print("輸入n的值:");//輸入有幾個階乘相加
    n=input.nextInt();
    sum=0;
    for(int i=1;i<=n;i++)
    {
    sum=sum+jie.jiecheng(i);//這是n個階乘相加
    }
    System.out.println("1!+2!+3!+....+n!的和是:"+sum);
    }
    }
    class Jiecheng
    {
    public int jiecheng(int temp)//算階乘的方法
    {
    int sum=1;
    for(int i=1;i<=temp;i++)
    {
    sum=sum*i; //計算階乘
    }
    return sum;//將一個階乘返回
    }
    }

2.java賽馬游戲:

import java.util.Random;
public class Test {
public static void main(String[] args) {
Competition c = new Competition();
Thread T = new Thread(c);
T.start();
}
}
class Competition implements Runnable{
int red = 0;
int green = 0;
int Speed [] = new int [2];
Competition(){

}
public void run(){
Random r = new Random();
for(int a= 0;a<500;a++){
for(int j = 0;j<2;j++){
Speed[j] = r.nextInt(2);
red = red + Speed[j];
Speed[j] = r.nextInt(2);
green = green + Speed[j];
}
System.out.println("red的速度為"+red);
System.out.println("green的速度為"+green);
while(red >=500 || green>=500){
if(red >=500){
System.out.println("red先抵達終點線");
}
if(green >= 500){
System.out.println("green先抵達終點線");
}
if(green ==500 && red ==500 ){
System.out.println("兩個同時到達");
}
return;
}
}
/* if(red >green){
System.out.println("Redwin"+red);
}
if(red<green){
S...import java.util.Random;
public class Test {
public static void main(String[] args) {
Competition c = new Competition();
Thread T = new Thread(c);
T.start();
}
}
class Competition implements Runnable{
int red = 0;
int green = 0;
int Speed [] = new int [2];
Competition(){

}
public void run(){
Random r = new Random();
for(int a= 0;a<500;a++){
for(int j = 0;j<2;j++){
Speed[j] = r.nextInt(2);
red = red + Speed[j];
Speed[j] = r.nextInt(2);
green = green + Speed[j];
}
System.out.println("red的速度為"+red);
System.out.println("green的速度為"+green);
while(red >=500 || green>=500){
if(red >=500){
System.out.println("red先抵達終點線");
}
if(green >= 500){
System.out.println("green先抵達終點線");
}
if(green ==500 && red ==500 ){
System.out.println("兩個同時到達");
}
return;
}
}
/* if(red >green){
System.out.println("Redwin"+red);
}
if(red<green){
System.out.println("Greenwin"+green);
}
if(red == green){
System.out.println("equal");*/

JAVA的介紹:

Java是一種可以撰寫跨平台應用程序的面向對象的程序設計語言。Java技術具有卓越的通用性、高效性、平台移植性和安全性,廣泛應用於PC、數據中心、游戲控制台、科學超級計算機、行動電話和互聯網,同時擁有全球最大的開發者專業社群。

7. 最經典的C語言編程軟體是什麼

個人推薦~初學者使用VC/VC++~!當然MSDN是必須要安裝的!
如果有興趣的話,建議LZ看看VB,相當簡單,超級好學~

8. 哪個編程語言最好

編程語言最好:
一、Java最流行
與一年前一樣,Java仍然是最流行的編程語言。據TIOBE的數據顯示,幾十年來,Java比其他語言更常名列榜首。許多知名公司使用Java來開發軟體和應用程序,所以如果你碰巧使用Java,絕對不必為找工作而苦惱。Java受歡迎的主要原因是它擁有可移植性、可擴展性和龐大的用戶社區。
二、經典的C語言
作為最古老的編程語言之一,C依然高居榜首,這歸功於其可移植性以及微軟、Oracle和蘋果等科技巨頭採用它。它與幾乎所有系統兼容,很適合操作系統和嵌入式系統。
由於運行時環境相對小巧,因此C是保持這種系統精簡的完美選擇。強烈建議初學者學C,它實際上是編程語言的通用語言,已催生出了同樣很受歡迎的衍生語言,比如C++和C#。
三、C ++繼續佔主導地位
這種面向對象編程語言在20世紀80年代開發而成,現在仍應用於從桌面Web應用程序到伺服器基礎設施的眾多系統。由於靈活性、高性能以及可用於多種環境,C ++依然很吃香。以C++為業的工作通常需要開發面向性能密集型任務的桌面應用程序。掌握C++可以更深入地了解編程語言,幫助獲得低級內存處理方面的技能。
四、Python:不斷上升
過去15年來,Python的受歡迎程度穩步上升。過去這幾年,它一直能夠躋身TIOBE指數前5名的位置。作為如今人工智慧、機器學習、大數據和機器人等一些最有前途的技術背後的主要語言,Python近年來積累了龐大的粉絲群。你會驚訝地發現學習Python很容易,這就是為什麼許多經驗豐富的開發人員選擇Python作為第二或第三語言的原因。

9. 經典C語言編程30例(二)

【程序31】
題目:請輸入星期幾的第一個字母來判斷一下是星期幾,如果第一個字母一樣,則繼續
判斷第二個字母。
1.程序分析:用情況語句比較好,如果第一個字母一樣,則判斷用情況語句或if語句判斷第二個字母。
2.程序源代碼:
#include
void main()
{
char letter;
printf("please input the first letter of someday\n");
while ((letter=getch())!='Y')/*當所按字母為Y時才結束*/
{ switch (letter)
{case 'S':printf("please input second letter\n");
if((letter=getch())=='a')
printf("saturday\n");
else if ((letter=getch())=='u')
printf("sunday\n");
else printf("data error\n");
break;
case 'F':printf("friday\n");break;
case 'M':printf("monday\n");break;
case 'T':printf("please input second letter\n");
if((letter=getch())=='u')
printf("tuesday\n");
else if ((letter=getch())=='h')
printf("thursday\n");
else printf("data error\n");
break;
case 'W':printf("wednesday\n");break;
default: printf("data error\n");
}
}
}
==============================================================
【程序32】
題目:Press any key to change color, do you want to try it. Please hurry up!
1.程序分析:
2.程序源代碼:
#include
void main(void)
{
int color;
for (color = 0; color < 8; color++)
{
textbackground(color);/*設置文本的背景顏色*/
cprintf("This is color %d\r\n", color);
cprintf("Press any key to continue\r\n");
getch();/*輸入字元看不見*/
}
}
==============================================================
【程序33】
題目:學習gotoxy()與clrscr()函數
1.程序分析:
2.程序源代碼:
#include
void main(void)
{
clrscr();/*清屏函數*/
textbackground(2);
gotoxy(1, 5);/*定位函數*/
cprintf("Output at row 5 column 1\n");
textbackground(3);
gotoxy(20, 10);
cprintf("Output at row 10 column 20\n");
}
==============================================================
【程序34】
題目:練習函數調用
1. 程序分析:
2.程序源代碼:
#include
void hello_world(void)
{
printf("Hello, world!\n");
}
void three_hellos(void)
{
int counter;
for (counter = 1; counter <= 3; counter++)
hello_world();/*調用此函數*/
}
void main(void)
{
three_hellos();/*調用此函數*/
}
==============================================================
【程序35】
題目:文本顏色設置
1.程序分析:
2.程序源代碼:
#include
void main(void)
{
int color;
for (color = 1; color < 16; color++)
{
textcolor(color);/*設置文本顏色*/
cprintf("This is color %d\r\n", color);
}
textcolor(128 + 15);
cprintf("This is blinking\r\n");
}
==============================================================
【程序36】
題目:求100之內的素數
1.程序分析:
2.程序源代碼:
#include
#include "math.h"
#define N 101
main()
{
int i,j,line,a[N];
for(i=2;ifor(i=2;i for(j=i+1;j {
if(a[i]!=0&&a[j]!=0)
if(a[j]%a[i]==0)
a[j]=0;}
printf("\n");
for(i=2,line=0;i{
if(a[i]!=0)
{printf("]",a[i]);
line++;}
if(line==10)
{printf("\n");
line=0;}
}
}
==============================================================
【程序37】
題目:對10個數進行排序
1.程序分析:可以利用選擇法,即從後9個比較過程中,選擇一個最小的與第一個元素交換,
下次類推,即用第二個元素與後8個進行比較,並進行交換。
2.程序源代碼:
#define N 10
main()
{int i,j,min,tem,a[N];
/*input data*/
printf("please input ten num:\n");
for(i=0;i{
printf("a[%d]=",i);
scanf("%d",&a[i]);}
printf("\n");
for(i=0;iprintf("]",a[i]);
printf("\n");
/*sort ten num*/
for(i=0;i{min=i;
for(j=i+1;jif(a[min]>a[j]) min=j;
tem=a[i];
a[i]=a[min];
a[min]=tem;
}
/*output data*/
printf("After sorted \n");
for(i=0;iprintf("]",a[i]);
}
==============================================================
【程序38】
題目:求一個3*3矩陣對角線元素之和
1.程序分析:利用雙重for循環控制輸入二維數組,再將a[i][i]累加後輸出。
2.程序源代碼:
main()
{
float a[3][3],sum=0;
int i,j;
printf("please input rectangle element:\n");
for(i=0;i<3;i++)
for(j=0;j<3;j++)
scanf("%f",&a[i][j]);
for(i=0;i<3;i++)
sum=sum+a[i][i];
printf("ijiaoxian he is %6.2f",sum);
}
==============================================================
【程序39】
題目:有一個已經排好序的數組。現輸入一個數,要求按原來的規律將它插入數組中。
1. 程序分析:首先判斷此數是否大於最後一個數,然後再考慮插入中間的數的情況,插入後
此元素之後的數,依次後移一個位置。
2.程序源代碼:
main()
{
int a[11]={1,4,6,9,13,16,19,28,40,100};
int temp1,temp2,number,end,i,j;
printf("original array is:\n");
for(i=0;i<10;i++)
printf("]",a[i]);
printf("\n");
printf("insert a new number:");
scanf("%d",&number);
end=a[9];
if(number>end)
a[10]=number;
else
{for(i=0;i<10;i++)
{ if(a[i]>number)
{temp1=a[i];
a[i]=number;
for(j=i+1;j<11;j++)
{temp2=a[j];
a[j]=temp1;
temp1=temp2;
}
break;
}
}
}
for(i=0;i<11;i++)
printf("m",a[i]);
}
==============================================================
【程序40】
題目:將一個數組逆序輸出。
1.程序分析:用第一個與最後一個交換。
2.程序源代碼:
#define N 5
main()
{ int a[N]={9,6,5,4,1},i,temp;
printf("\n original array:\n");
for(i=0;i printf("M",a[i]);
for(i=0;i {temp=a[i];
a[i]=a[N-i-1];
a[N-i-1]=temp;
}
printf("\n sorted array:\n");
for(i=0;i printf("M",a[i]);
}
【程序41】
題目:學習static定義靜態變數的用法
1.程序分析:
2.程序源代碼:
#include "stdio.h"
varfunc()
{
int var=0;
static int static_var=0;
printf("\40:var equal %d \n",var);
printf("\40:static var equal %d \n",static_var);
printf("\n");
var++;
static_var++;
}
void main()
{int i;
for(i=0;i<3;i++)
varfunc();
}
==============================================================
【程序42】
題目:學習使用auto定義變數的用法
1.程序分析:
2.程序源代碼:
#include "stdio.h"
main()
{int i,num;
num=2;
for (i=0;i<3;i++)
{ printf("\40: The num equal %d \n",num);
num++;
{
auto int num=1;
printf("\40: The internal block num equal %d \n",num);
num++;
}
}
}
==============================================================
【程序43】
題目:學習使用static的另一用法。
1.程序分析:
2.程序源代碼:
#include "stdio.h"
main()
{
int i,num;
num=2;
for(i=0;i<3;i++)
{
printf("\40: The num equal %d \n",num);
num++;
{
static int num=1;
printf("\40:The internal block num equal %d\n",num);
num++;
}
}
}
==============================================================
【程序44】
題目:學習使用external的用法。
1.程序分析:
2.程序源代碼:
#include "stdio.h"
int a,b,c;
void add()
{ int a;
a=3;
c=a+b;
}
void main()
{ a=b=4;
add();
printf("The value of c is equal to %d\n",c);
}
==============================================================
【程序45】
題目:學習使用register定義變數的方法。
1.程序分析:
2.程序源代碼:
void main()
{
register int i;
int tmp=0;
for(i=1;i<=100;i++)
tmp+=i;
printf("The sum is %d\n",tmp);
}
==============================================================
【程序46】
題目:宏#define命令練習(1)
1.程序分析:
2.程序源代碼:
#include "stdio.h"
#define TRUE 1
#define FALSE 0
#define SQ(x) (x)*(x)
void main()
{
int num;
int again=1;
printf("\40: Program will stop if input value less than 50.\n");
while(again)
{
printf("\40:Please input number==>");
scanf("%d",&num);
printf("\40:The square for this number is %d \n",SQ(num));
if(num>=50)
again=TRUE;
else
again=FALSE;
}
}
==============================================================
【程序47】
題目:宏#define命令練習(2)
1.程序分析:
2.程序源代碼:
#include "stdio.h"
#define exchange(a,b) { \ /*宏定義中允許包含兩道衣裳命令的情形,此時必須在最右邊加上"\"*/
int t;\
t=a;\
a=b;\
b=t;\
}
void main(void)
{
int x=10;
int y=20;
printf("x=%d; y=%d\n",x,y);
exchange(x,y);
printf("x=%d; y=%d\n",x,y);
}
==============================================================
【程序48】
題目:宏#define命令練習(3)
1.程序分析:
2.程序源代碼:
#define LAG >
#define SMA <
#define EQ ==
#include "stdio.h"
void main()
{ int i=10;
int j=20;
if(i LAG j)
printf("\40: %d larger than %d \n",i,j);
else if(i EQ j)
printf("\40: %d equal to %d \n",i,j);
else if(i SMA j)
printf("\40:%d smaller than %d \n",i,j);
else
printf("\40: No such value.\n");
}
==============================================================
【程序49】
題目:#if #ifdef和#ifndef的綜合應用。
1. 程序分析:
2.程序源代碼:
#include "stdio.h"
#define MAX
#define MAXIMUM(x,y) (x>y)?x:y
#define MINIMUM(x,y) (x>y)?y:x
void main()
{ int a=10,b=20;
#ifdef MAX
printf("\40: The larger one is %d\n",MAXIMUM(a,b));
#else
printf("\40: The lower one is %d\n",MINIMUM(a,b));
#endif
#ifndef MIN
printf("\40: The lower one is %d\n",MINIMUM(a,b));
#else
printf("\40: The larger one is %d\n",MAXIMUM(a,b));
#endif
#undef MAX
#ifdef MAX
printf("\40: The larger one is %d\n",MAXIMUM(a,b));
#else
printf("\40: The lower one is %d\n",MINIMUM(a,b));
#endif
#define MIN
#ifndef MIN
printf("\40: The lower one is %d\n",MINIMUM(a,b));
#else
printf("\40: The larger one is %d\n",MAXIMUM(a,b));
#endif
}
==============================================================
【程序50】
題目:#include 的應用練習
1.程序分析:
2.程序源代碼:
test.h 文件如下:
#define LAG >
#define SMA <
#define EQ ==
#include "test.h" /*一個新文件50.c,包含test.h*/
#include "stdio.h"
void main()
{ int i=10;
int j=20;
if(i LAG j)
printf("\40: %d larger than %d \n",i,j);
else if(i EQ j)
printf("\40: %d equal to %d \n",i,j);
else if(i SMA j)
printf("\40:%d smaller than %d \n",i,j);
else
printf("\40: No such value.\n");
}
【程序51】
題目:學習使用按位與 & 。
1.程序分析:0&0=0; 0&1=0; 1&0=0; 1&1=1
2.程序源代碼:
#include "stdio.h"
main()
{
int a,b;
a=077;
b=a&3;
printf("\40: The a & b(decimal) is %d \n",b);
b&=7;
printf("\40: The a & b(decimal) is %d \n",b);
}
==============================================================
【程序52】
題目:學習使用按位或 | 。
1.程序分析:0|0=0; 0|1=1; 1|0=1; 1|1=1
2.程序源代碼:
#include "stdio.h"
main()
{
int a,b;
a=077;
b=a|3;
printf("\40: The a & b(decimal) is %d \n",b);
b|=7;
printf("\40: The a & b(decimal) is %d \n",b);
}
==============================================================
【程序53】
題目:學習使用按位異或 ^ 。
1.程序分析:0^0=0; 0^1=1; 1^0=1; 1^1=0
2.程序源代碼:
#include "stdio.h"
main()
{
int a,b;
a=077;
b=a^3;
printf("\40: The a & b(decimal) is %d \n",b);
b^=7;
printf("\40: The a & b(decimal) is %d \n",b);
}
==============================================================
【程序54】
題目:取一個整數a從右端開始的4~7位。
程序分析:可以這樣考慮:
(1)先使a右移4位。
(2)設置一個低4位全為1,其餘全為0的數。可用~(~0<<4)
(3)將上面二者進行&運算。
2.程序源代碼:
main()
{
unsigned a,b,c,d;
scanf("%o",&a);
b=a>>4;
c=~(~0<<4);
d=b&c;
printf("%o\n%o\n",a,d);
}
==============================================================
【程序55】
題目:學習使用按位取反~。
1.程序分析:~0=1; ~1=0;
2.程序源代碼:
#include "stdio.h"
main()
{
int a,b;
a=234;
b=~a;
printf("\40: The a's 1 complement(decimal) is %d \n",b);
a=~a;
printf("\40: The a's 1 complement(hexidecimal) is %x \n",a);
}
==============================================================
【程序56】
題目:畫圖,學用circle畫圓形。
1.程序分析:
2.程序源代碼:
/*circle*/
#include "graphics.h"
main()
{int driver,mode,i;
float j=1,k=1;
driver=VGA;mode=VGAHI;
initgraph(&driver,&mode,"");
setbkcolor(YELLOW);
for(i=0;i<=25;i++)
{
setcolor(8);
circle(310,250,k);
k=k+j;
j=j+0.3;
}
}
==============================================================
【程序57】
題目:畫圖,學用line畫直線。
1.程序分析:
2.程序源代碼:
#include "graphics.h"
main()
{int driver,mode,i;
float x0,y0,y1,x1;
float j=12,k;
driver=VGA;mode=VGAHI;
initgraph(&driver,&mode,"");
setbkcolor(GREEN);
x0=263;y0=263;y1=275;x1=275;
for(i=0;i<=18;i++)
{
setcolor(5);
line(x0,y0,x0,y1);
x0=x0-5;
y0=y0-5;
x1=x1+5;
y1=y1+5;
j=j+10;
}
x0=263;y1=275;y0=263;
for(i=0;i<=20;i++)
{
setcolor(5);
line(x0,y0,x0,y1);
x0=x0+5;
y0=y0+5;
y1=y1-5;
}
}
==============================================================
【程序58】
題目:畫圖,學用rectangle畫方形。
1.程序分析:利用for循環控制100-999個數,每個數分解出個位,十位,百位。
2.程序源代碼:
#include "graphics.h"
main()
{int x0,y0,y1,x1,driver,mode,i;
driver=VGA;mode=VGAHI;
initgraph(&driver,&mode,"");
setbkcolor(YELLOW);
x0=263;y0=263;y1=275;x1=275;
for(i=0;i<=18;i++)
{
setcolor(1);
rectangle(x0,y0,x1,y1);
x0=x0-5;
y0=y0-5;
x1=x1+5;
y1=y1+5;
}
settextstyle(DEFAULT_FONT,HORIZ_DIR,2);
outtextxy(150,40,"How beautiful it is!");
line(130,60,480,60);
setcolor(2);
circle(269,269,137);
}
==============================================================
【程序59】
題目:畫圖,綜合例子。
1.程序分析:
2.程序源代碼:
# define PAI 3.1415926
# define B 0.809
# include "graphics.h"
#include "math.h"
main()
{
int i,j,k,x0,y0,x,y,driver,mode;
float a;
driver=CGA;mode=CGAC0;
initgraph(&driver,&mode,"");
setcolor(3);
setbkcolor(GREEN);
x0=150;y0=100;
circle(x0,y0,10);
circle(x0,y0,20);
circle(x0,y0,50);
for(i=0;i<16;i++)
{
a=(2*PAI/16)*i;
x=ceil(x0+48*cos(a));
y=ceil(y0+48*sin(a)*B);
setcolor(2); line(x0,y0,x,y);}
setcolor(3);circle(x0,y0,60);
/* Make 0 time normal size letters */
settextstyle(DEFAULT_FONT,HORIZ_DIR,0);
outtextxy(10,170,"press a key");
getch();
setfillstyle(HATCH_FILL,YELLOW);
floodfill(202,100,WHITE);
getch();
for(k=0;k<=500;k++)
{
setcolor(3);
for(i=0;i<=16;i++)
{
a=(2*PAI/16)*i+(2*PAI/180)*k;
x=ceil(x0+48*cos(a));
y=ceil(y0+48+sin(a)*B);
setcolor(2); line(x0,y0,x,y);
}
for(j=1;j<=50;j++)
{
a=(2*PAI/16)*i+(2*PAI/180)*k-1;
x=ceil(x0+48*cos(a));
y=ceil(y0+48*sin(a)*B);
line(x0,y0,x,y);
}
}
restorecrtmode();
}
==============================================================
【程序60】
題目:畫圖,綜合例子。
1.程序分析:
2.程序源代碼:
#include "graphics.h"
#define LEFT 0
#define TOP 0
#define RIGHT 639
#define BOTTOM 479
#define LINES 400
#define MAXCOLOR 15
main()
{
int driver,mode,error;
int x1,y1;
int x2,y2;
int dx1,dy1,dx2,dy2,i=1;
int count=0;
int color=0;
driver=VGA;
mode=VGAHI;
initgraph(&driver,&mode,"");
x1=x2=y1=y2=10;
dx1=dy1=2;
dx2=dy2=3;
while(!kbhit())
{
line(x1,y1,x2,y2);
x1+=dx1;y1+=dy1;
x2+=dx2;y2+dy2;
if(x1<=LEFT||x1>=RIGHT)
dx1=-dx1;
if(y1<=TOP||y1>=BOTTOM)
dy1=-dy1;
if(x2<=LEFT||x2>=RIGHT)
dx2=-dx2;
if(y2<=TOP||y2>=BOTTOM)
dy2=-dy2;
if(++count>LINES)
{
setcolor(color);
color=(color>=MAXCOLOR)?0:++color;
}
}
closegraph();
}

10. 誰發明了那些經典的編程語言

我也抄一下。
奧古斯塔·阿達·金,勒芙蕾絲伯爵夫人(augusta
ada
king,
countess
of
lovelace,1815年12月10日-1852年11月27日),原名奧古斯塔·阿達·拜倫(augusta
ada
byron),通稱阿達·洛芙萊斯(ada
lovelace),是著名英國詩人拜倫之女,數學家。計算機程序創始人,建立了循環和子程序概念。
為計算程序擬定「演算法」,寫作的第一份「程序設計流程圖」,被珍視為「第一位給計算機寫程序的人」。為了紀念阿達·奧古斯塔對現代電腦與軟體工程所產生的重大影響,美國國防部將耗費巨資、歷時近20年研製成功的高級程序語言命名為ada語言,它被公認為是第四代計算機語言的主要代表。
在1842年,人稱「數字女王」的阿達·洛芙萊斯(ada
lovelace)編寫了歷史上首款電腦程序。
在1834年,阿達的朋友——英國數學家、發明家兼機械工程師查爾斯·巴貝其(charles
babbage)——發明了一台分析機;阿達則致力於為該分析機編寫演算法,並於1843
年公布了世界上第一套演算法。
巴貝其分析機後來被認為是最早期的計算機雛形,而阿達的演算法則被認為是最早的計算機程序和軟體。
1852年,阿達為了治療子宮頸癌,卻因此死於失血過多,得年36歲。無獨有偶,她與她父親拜倫死於相同年齡,一樣死於治療中的失血過多。她留下了兩個兒子與一位女兒—安妮·布蘭特貴女。
依她的遺言,阿達葬於諾丁漢哈克諾的聖
瑪麗亞·抹大拉教堂,長眠在父親的身旁。
在1842年與1843年其間,阿達花了9個月的時間翻譯義大利數學家路易吉·米那比亞對巴貝奇最新的計算機設計書(即分析機概論)所留下的備忘錄。在這部譯文里,她附加許多注記,內容詳細說明用計算機進行伯努利數的運算方式,而被認為是世界上第一個電腦程式;因此,阿達也被認為是世界上第一位程式設計師。巴貝奇在他所著的《經過哲學家人生》(passages
from
the
life
of
a
philosopher,
1846)里留有下面的述敘:
倫敦科學館分析機復製品
「我認為她為米那比亞的備忘錄增加許多注記,並加入了一些想法。雖然這些想法是由我們一起討論出來的,但是最後被寫進注記里的想法確確實實是她自己的構想。我將許多代數運算的問題交給她處理,這些工作也與伯努利數的運算相關。在她所送回給我的文件,更修正了我先前在程序里的重大錯誤。」
阿達的文章創造出許多巴貝奇也未曾提到的新構想,比如阿達曾經預言道:「這個機器未來可以用來排版、編曲或是各種更復雜的用途。」
她死後一百年,於1953年,阿達之前對查爾斯·巴貝奇的《分析機概論》所留下的筆記被重新公布,並被公認對現代計算機與軟體工程造成了重大影響。[2]
在1980年12月10日,美國國防部製作了一個新的高級計算機編程語言——ada,以紀念阿達·洛芙萊斯。
在微軟的wins產品里也可以找到阿達的全息圖標簽。
英國計算機公會每年都頒發以阿達命名的軟體工程創新大獎。

熱點內容
qq群里上傳的文件怎麼刪除 發布:2024-04-24 22:13:21 瀏覽:357
途岳配置升級了什麼 發布:2024-04-24 21:55:55 瀏覽:886
刷機安卓10狀態欄圓角如何修復 發布:2024-04-24 21:24:00 瀏覽:135
創建sql資料庫的命令是什麼 發布:2024-04-24 21:23:58 瀏覽:43
不是安卓該如何下載畫質怪獸 發布:2024-04-24 21:18:51 瀏覽:701
php載入網頁 發布:2024-04-24 21:15:20 瀏覽:161
遠程伺服器更換ip地址 發布:2024-04-24 21:14:43 瀏覽:528
什麼時候上線華為方舟編譯器軟體 發布:2024-04-24 21:10:21 瀏覽:631
安卓布局文件指的是哪個 發布:2024-04-24 21:08:05 瀏覽:889
磁帶存儲價格 發布:2024-04-24 21:04:22 瀏覽:902