導航:首頁 > 編程語言 > 程序開發範例寶典源碼

程序開發範例寶典源碼

發布時間:2023-11-28 22:13:24

『壹』 ASP程序開發範例寶典的目錄

第1章表單、窗口與導航條設計
1.1下拉列表
實例001把資料庫中的記錄顯示到下拉列表中
實例002將數組中的數據添加到下拉列表中
實例003級聯菜單
實例004修改數據時下拉列表的默認值為資料庫中原數據信息
實例005可以輸入文字的下拉列表
實例006應用下拉列表選擇所要聯機的網站
實例007根據下拉列表的值顯示不同控制項
1.2動態添加表單元素
實例008根據數據表結構自動生成數據錄入頁面
實例009投票信息一次性設置
1.3文本框組件的應用
實例010自動計算金額
實例011設置文本框的只讀屬性
實例012讓您的密碼域更安全
實例013限制多行文本域輸入的字元個數
1.4單選按鈕組
實例014不提交表單獲取單選按鈕的值
實例015選中單選按鈕後顯示其他表單元素
1.5表單的應用
實例016防止表單在網站外部提交
實例017帶記憶功能的表單
1.6彈出窗口控制
實例018打開新窗口顯示廣告信息
實例019自動關閉的廣告窗口
實例020彈出窗口居中顯示
實例021打開新窗口顯示詳細信息
實例022彈出窗口的Cookie控制
實例023為彈出的窗口加入關閉按鈕
實例024關閉彈出窗口時刷新父窗口
實例025應用window.close()關閉窗口
1.7彈出網頁對話框
實例026彈出網頁(模式)對話框
實例027彈出全屏顯示的網頁(模式)對話框
實例028網頁拾色器
1.8無邊框窗口
實例029全屏顯示無邊框有滾動條窗口
實例030應用JavaScript實現指定尺寸的無邊框窗口
實例031應用CSS+DIV實現無邊框窗口
1.9水平導航條應用
實例032帶圖標的文字導航條
實例033flash導航條
實例034按鈕導航條
實例035導航條的動畫效果
實例036不用圖片實現質感導航條
1.10下拉菜單式導航條
實例037二級導航菜單
實例038半透明背景的下拉菜單
實例039彈出式下拉菜單
實例040展開式導航條
1.11側導航條設計
實例041導航按鈕
實例042收縮式導航菜單
實例043樹狀導航菜單
第2章代碼封裝技術
2.1資料庫操作函數
實例044通用資料庫連接函數
實例045測試資料庫連接
2.2窗口與對話框
實例046彈出提示對話框並重定向網頁
實例047打開指定大小的新窗口並居中顯示
2.3字元串處理
實例048自動獲得漢字的拼音簡碼
實例049轉換輸入文本中的回車和空格
實例050小寫金額轉換為大寫金額
實例051判斷字元串是否以指定字元開頭
實例052把一個長數字分位顯示
實例053檢查字元是否是英文字母
實例054計算字元串的實際長度
實例055將數字字元串格式化為指定長度
實例056將RGB格式的顏色值轉換為十六進制格式
實例057將IP地址轉換為對應的數值
實例058字元串轉換成數組
實例059截取字元串
實例060ASP生成條形碼
實例061過濾輸入字元串中的危險符號
2.4數據驗證
實例062驗證輸入的日期格式是否正確
實例063檢查表單元素是否為空
實例064伺服器端驗證E-mail是否正確
實例065客戶端驗證E-mail是否正確
實例066通過正則表達式驗證電話號碼
實例067應用正則表達式驗證車牌號碼
實例068驗證輸入的字元串是否為漢字
實例069驗證身份證號碼
實例070客戶端驗證用戶名和密碼
實例071驗證網址是否合法
實例072驗證數量和金額
實例073限制輸入字元串的長度
2.5身份驗證
實例074用戶登錄模塊
實例075帶狀態識別的用戶登錄模塊
2.6日期與時間
實例076顯示長日期格式的系統日期
實例077實時顯示系統時間
實例078倒計時
實例079特殊日期提示
2.7隨機函數
實例080隨機產生指定位數的驗證碼
實例081生成隨機字元串
第3章資料庫技術
3.1連接Access資料庫
實例082通過DSN連接資料庫
實例083通過ADO連接資料庫
實例084通過OLEDB連接資料庫
實例085連接加密的Access資料庫
3.2連接SQLServer資料庫
實例086通過非DSN連接資料庫
實例087通過OLEDB連接資料庫
實例088通過DSN連接資料庫
3.3數據插入
實例089單條數據錄入
實例090批量數據錄入
實例091插入系統日誌信息
3.4立即獲取插入記錄的自動編號
實例092獲取SQLServer資料庫中插入記錄的自動編號
實例093獲取Access資料庫中插入記錄的自動編號
3.5數據更新
實例094更新指定記錄
實例095批量更新
實例096商品價格調整
3.6數據刪除
實例097刪除指定記錄
實例098批量刪除數據
實例099刪除數據前給予提示
實例100記錄從資料庫里刪除的記錄數
3.7分頁顯示數據信息
實例101分頁顯示
實例102查詢結果分頁顯示
實例103轉到指定頁的分頁
實例104具有頁碼跳轉功能的分頁
實例105分欄顯示
實例106分類、分欄顯示
實例107統計記錄集中數據的數量
實例108對超長文本數據進行分頁顯示
3.8密碼管理
實例109修改密碼
實例110找回密碼
3.9鎖定記錄
實例111在線售票
實例112自動生成編號
3.10在ASP中應用事務
實例113事務在插入多表數據中的應用
實例114事務在添加留言信息中的應用
實例115事務在刪除數據中的應用
3.11使用代碼創建資料庫、數據表和欄位
實例116動態創建Access資料庫
實例117動態創建SQL資料庫
實例118動態創建SQL數據表和欄位
3.12枚舉資料庫中的數據表
實例119列舉SQLServer資料庫中的數據表
實例120列舉Access資料庫中的數據表
3.13查看及修改數據表結構
實例121查看數據表結構
實例122在線維護投票資料庫
3.14在線刪除表或索引
實例123在線刪除指定的一個數據表
實例124在線刪除多個指定的數據表
實例125在線刪除索引
3.15清除部分或全部數據表中的數據
實例126清空指定數據表中的所有數據
實例127清空指定數據表中的全部記錄並插入指定ID的新記錄
實例128批量清空數據表
3.16生成和恢復SQL資料庫腳本
實例129生成SQL資料庫腳本
實例130恢復SQL資料庫腳本
3.17SQLServer資料庫備份與恢復
實例131SQLServer數據備份
實例132SQLServer數據恢復
3.18Access資料庫備份與恢復
實例133Access數據備份
實例134Access數據恢復
實例135Access數據壓縮
3.19其他
實例136不刷新頁面篩選資料庫中的數據
實例137動態附加資料庫
實例138連接Oracle資料庫
第4章SQL查詢相關技術
4.1查詢常量
實例139查詢數值型數據
實例140查詢字元串
實例141查詢日期型數據
實例142查詢邏輯型數據
實例143查詢非空數據
4.2查詢控制項
實例144查詢指定控制項內字元串
實例145查詢指定控制項內數據
實例146查詢日期控制項內數據
實例147控制項作為欄位、操作符和內容進行查詢
4.3查詢變數
實例148利用變數查詢字元串數據
實例149利用變數查詢數值型數據
4.4查詢名列前茅或墊底者
實例150查詢前10名數據
實例151查詢後10名數據
實例152取出數據統計結果前10名數據
4.5周期、日期查詢
實例153查詢指定ACCESS資料庫中的日期型數據
實例154查詢指定SQLServer資料庫中的日期型數據
實例155查詢指定時間段的數據
實例156按月查詢統計數據
4.6大小比較、邏輯查詢、重復
實例157查詢大於指定條件的數據
實例158查詢時不顯示重復記錄
實例159NOT與謂詞進行組合條件的查詢
實例160列出數據中的重復記錄和記錄條數
4.7排序、分組統計
實例161對數據進行降序查詢
實例162對數據進行多條件排序
實例163對統計結果進行排序
實例164單列數據分組統計
實例165多列數據分組統計
實例166多表分組統計
實例167使用COMPUTER和COMPUTERBY
4.8聚集函數
實例168利用聚集函數SUM對學生成績進行匯總
實例169利用聚集函數AVG求某班學生的平均成績
實例170利用聚集函數MIN求銷售額、利潤最少的商品
實例171利用聚集函數MAX求月銷售額完成最多的銷售記錄
實例172利用聚集函數COUNT求日銷售額大於某值的記錄數
實例173利用聚集函數First或Last求數據表中第一條或最後一條記錄
4.9多表查詢
實例174利用from子句進行多表查詢
實例175使用表的別名
實例176合並多個結果集
4.10嵌套查詢
實例177簡單的嵌套查詢
實例178復雜的嵌套查詢
實例179嵌套查詢在查詢統計中的應用
4.11子查詢
實例180用子查詢作派生的表
實例181用子查詢作表達式
實例182用子查詢關聯數據
4.12聯合語句
實例183多表聯合查詢
實例184對聯合查詢後的結果進行排序
實例185條件聯合語句
4.13內連接查詢
實例186簡單內連接查詢
實例187復雜內連接查詢
實例188選擇一個表中與另一個表中的行相關的所有行
4.14外連接查詢
實例189使用外連接進行多表聯合查詢
實例190leftouterjoin查詢
實例191rightouterjoin查詢
4.15利用IN進行查詢
實例192利用in或notin語句限定范圍
實例193用IN查詢表中的記錄信息
實例194由IN引入的關聯子查詢
4.16交叉表查詢
實例195利用transform分析數據
實例196利用transform動態分析數據
4.17函數查詢
實例197在查詢語句中使用格式化函數格式條件
實例198在查詢中使用字元串函數
實例199在查詢中使用日期函數
4.18HAVING語句應用
實例200利用having語句過濾分組數據
4.19更新數據
實例201更新單條數據
實例202批量修改數據
實例203將指定欄位數據為空的記錄添上數據
4.20刪除數據
實例204刪除單條數據
實例205刪除指定欄位數據為空的記錄
第5章視圖、存儲過程和觸發器的應用
5.1視圖的應用
實例206創建視圖
實例207在ASP中應用視圖
實例208獲取資料庫中的全部用戶視圖
實例209修改視圖
實例210刪除視圖
5.2在ASP中使用存儲過程
實例211創建存儲過程
實例212應用存儲過程實現登錄身份驗證
實例213應用存儲過程添加數據
實例214應用存儲過程實現數據分頁
實例215獲取資料庫中全部的存儲過程
實例216修改存儲過程
實例217刪除存儲過程
5.3在ASP中使用SQLServer觸發器
實例218創建觸發器
實例219應用觸發器自動插入回復記錄
實例220獲取資料庫中的觸發器
實例221應用觸發器添加數據
實例222應用觸發器修改數據
實例223應用觸發器刪除數據
第6章文件管理
6.1文件上傳
實例224單一文件上傳到資料庫
實例225將文件與表單數據一同上傳到資料庫
實例226使用組件上傳文件到資料庫
實例227上傳文件到伺服器
實例228使用組件上傳文件到伺服器
實例229限制上傳文件的大小
6.2文件下載
實例230應用Stream對象實現文件下載
實例231獲取下載文件所需時間
6.3對文件的基本操作
實例232對文件的創建、刪除、移動、復制的操作
實例233對文件名稱的修改
6.4文件操控
實例234從文本文件中讀取注冊服務條款
實例235應用文本文件保存訪客人數的計數器
實例236判斷文件是否被改動
實例237遠程批量重命名文件
實例238通過文本文件向資料庫文件中傳遞數據
實例239用ASP生成HTML
6.5對文件夾的操作
實例240對文件夾創建、刪除、移動、復制的操作
實例241對文件夾名稱的修改
6.6遍歷文件
實例242遍歷指定目錄下的所有文件
實例243遍歷指定驅動器
實例244獲取驅動器信息
6.7其他
實例245獲取文件信息
實例246讀取注冊表信息
實例247讀取驅動器信息
第7章圖形與多媒體
7.1頭像選擇
實例248通過下拉列表選擇頭像
實例249從網頁對話框中選擇頭像
7.2圖片上傳
實例250將圖片文件保存到數據表
實例251限制上傳圖片的格式
7.3顯示數據表中的二進制圖片
實例252顯示數據表中的單個圖片文件
實例253連續顯示數據表中的圖片
實例254按實際大小顯示圖片
7.4控制、顯示圖片特效
實例255通過滑動滑鼠放大或縮小圖片
實例256顯示隨機圖像
實例257如何實現圖片的動態翻動的效果
實例258播放圖片
實例259浮動廣告
實例260投票結果柱形圖顯示
實例261獲取頁面中圖像的實際尺寸
7.5插入Flash動畫
實例262插入Flash動畫
實例263插入背景透明的Flash動畫
7.6在線播放與下載
實例264在線點播
實例265MP3文件下載
實例266自製視頻播放器
實例267帶記憶的在線影片欣賞
第8章在線統計
8.1網站計數器
實例268通過Application對象實現網站計數器
實例269網站圖形計數器
實例270記錄用戶IP地址的計數器
實例271隻對新用戶計數的計數器
8.2統計用戶停留時間
實例272統計用戶在某一頁停留的時間
實例273統計用戶在站點停留的時間
8.3在線統計
實例274判斷用戶是否在線
實例275實時統計在線人數
8.4統計網站訪問量
實例276統計日訪問量
實例277利用柱形圖統計分析網站訪問量
第9章ActiveX組件
9.1廣告輪顯組件
實例278製作旗幟廣告條
實例279隨機廣告
9.2計數器組件
實例280圖形計數器
實例281幸運有獎
實例282自動生成Web導航鏈接(contentlinking組件實現)
9.3BrowserCapabilities組件
實例283顯示瀏覽器信息
實例284根據獲取的瀏覽器名稱及版本顯示不同的頁面
9.4注冊DLL或OCX組件
實例285本機注冊
實例286遠程注冊DLL組件
9.5圖表分析組件
實例287獲取情報曲線分析圖
實例288年銷售額及利潤柱形圖分析
實例289年銷售額及利潤折線圖分析
9.6VB訂制組件
實例290文件上傳組件
實例291Ping組件
9.7調用Delphi編寫的OCX組件
實例292顯示系統時鍾組件
實例293自製媒體播放器組件
9.8日歷組件
實例294調用MicrosoftDateandTimePicker組件
實例295調用Delphi編寫的日歷組件
第10章E-mail簡訊
10.1發送郵件
實例296利用E-mail發送郵件
實例297郵件群發
實例298帶附件的郵件發送程序
實例299利用AspEmail組件發送郵件
實例300利用MicrosoftOutLook發送郵件
10.2構建郵件伺服器
實例301利用CDONTS組件發送郵件
實例302接收郵件
第11章報表與列印
11.1Web列印
實例303利用JavaScript調用IE自身的列印功能實現列印
實例304利用WebBrowse列印
11.2利用Word列印報表
實例305將頁面中的客戶列表導出到Word並列印
實例306利用Word自動列印指定格式的會議記錄
11.3利用Excel列印報表
實例307利用Excel列印學生信息報表
實例308將web頁面中的數據導出到Excel並自動列印
11.4列印庫存報表
實例309列印庫存明細表
實例310列印庫存檔點報表
實例311列印庫存匯總報表
實例312列印指定條件的庫存報表
11.5套打郵寄產品單
實例313列印匯款單
實例314列印快遞單
實例315列印信封
11.6利用CSS樣式列印
實例316利用CSS樣式列印頁面中的指定內容
實例317利用CSS樣式實現分頁列印
第12章應用與控制
12.1調用Word
實例318將表格數據保存到Word
實例319將查詢結果保存到Word
12.2在ASP中訪問Excel
實例320通過ADO訪問Excel
實例321直接訪問Excel
12.3導出數據到Excel
實例322將table數據導出到Excel
實例323將查詢結果導出到Excel
12.4導出SQLServer數據
實例324將數據導出到Access資料庫
實例325將數據導出到Excel
12.5ASP中壓縮與解壓縮RAR文件
實例326ASP中壓縮RAR文件
實例327ASP中解壓縮RAR文件
12.6其他
實例328在ASP中調用PowerPoint
實例329在ASP中編寫並調用類
第13章Ajax技術
13.1ASP操作XML數據
實例330向XML文件中動態添加數據
實例331讀取指定XML文件中的數據
實例332分頁顯示XML文件中的數據
13.2無刷新技術應用
實例333不刷新頁面查詢資料庫中的數據
實例334實時驗證用戶注冊信息
實例335XML留言板
實例336無刷新廣告輪顯
第14章安全技術
14.1用戶登錄
實例337用戶安全登錄
實例338帶驗證碼的用戶登錄模塊
實例339分級用戶登錄
實例340如果未登錄瀏覽某頁,強制跳到登錄頁面
14.2許可權
實例341測試管理員級別
實例342許可權不夠彈出的對話框
14.3獲取客戶端信息
實例343確定對方的IP地址
實例344獲取客戶端TCP/IP埠的方法
14.4禁止用戶復制網頁內容及保護源碼
實例345禁止用戶復制網頁內容(方法一)
實例346禁止用戶復制網頁內容(方法二)
實例347禁止網頁被另存為
實例348防止網頁被盜鏈
實例349使用ScriptEncoder加密工具加密
實例350將ASP文件轉換成HTML文件
14.5數據加密
實例351對登錄密碼進行加密
實例352應用變換法對系統日誌信息加密
實例353應用數字加密演算法對用戶密碼加密
14.6Access資料庫安全
實例354防止Access資料庫被下載
實例355設置資料庫密碼
14.7防止SQL注入
實例356替換輸入字元串中的危險字元
實例357禁止用戶輸入字元串中的危險字元
實例358防止表單被重復提交
14.8禁止用戶刷新屏幕
實例359屏蔽IE主菜單
實例360屏蔽鍵盤相關事件
實例361屏蔽滑鼠右鍵
第15章建站與程序調試
15.1配置IIS伺服器
實例362在Windows2000Server中配置IIS5.0
實例363在WindowsXP+IIS中配置IIS
實例364在Windows2003Server中配置IIS
15.2配置資料庫伺服器需要注意的事項
實例365SQLServer資料庫注意事項
實例366Access資料庫不能更新
15.3程序調試與錯誤處理
實例367應用MicrosoftScriptDebugger調試程序
實例368解決SQLServer中用戶登錄失敗
實例369解決SQLServer語句出現的錯誤
實例370解決「沒有許可權」錯誤
實例371截獲系統錯誤並給出友好提示
實例372常用錯誤代碼一覽
15.4伺服器安全設置
實例373設置和管理賬戶
實例374windows2003安裝的安全設置
實例375Windows2003遠程管理WEB站點
實例376Windows安全設置
實例377配置IIS服務
實例378管理伺服器IIS用戶
15.5其他
實例379FTP伺服器
實例380在IIS中建立WAP伺服器
實例381Asp配置虛擬目錄
第16章網站設計與網頁配色
16.1企業網站
實例382電腦產品
實例383軟體產品
實例384汽車銷售
實例385物流
實例386賓館酒店
實例387工業產品
16.2大型門戶類網站
實例388綜合性門戶
實例389搜索引擎
實例390垂直門戶
16.3機構類網站
實例391政務
實例392市委黨校
實例393銀行
16.4教育類網站
實例394院校
實例395招生
實例396科研
實例397培訓學校
實例398考試
16.5電子商務類
實例399圖書
實例400購物
16.6生活資訊類
實例401電信
實例402家居
實例403中介
實例404房地產
16.7其他
實例405個人主頁
實例406游戲
實例407電影
實例408美食
第17章行業應用(綜合應用)
17.1用戶注冊
實例409一般用戶注冊
實例410帶檢測用戶名的用戶注冊
實例411分步用戶注冊
17.2留言本
實例412簡易留言本
實例413留言本(留言分類)
實例414留言本(版主回復)
17.3在線投票系統
實例415網上投票系統(限制多次投票)
實例416網上投票系統(一個IP一月只能投票一次)
17.4論壇
實例417查看帖子信息
實例418發表主題信息
實例419回復主題信息
實例420刪除主題及回復信息
實例421安全退出
17.5購物車
實例422添加至購物車
實例423查看購物車
實例424從購物車中移去指定商品
實例425修改商品購買數量
實例426清空購物車
實例427收銀台結賬
17.6萬年歷
實例428簡易萬年歷
實例429帶有備忘錄的萬年歷
17.7聊天室
實例430Application形式的聊天室
實例431資料庫形式的聊天室(10分鍾不說話用戶下線)
實例432聊天室(私聊)
17.8搜索
實例433一般搜索
實例434高級搜索
實例435常用搜索
技術要點對應實例位置
……

『貳』 用C語言開發簡單的應用系統程序,源代碼不得少於150行

火車站售票查詢系統:

#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int shoudsave=0 ;
int count1=0,count2=0,mark=0,mark1=0 ;
/*定義存儲火車信息的結構體*/
struct train
{
char num[10];/*列車號*/
char city[10];/*目的城市*/
char takeoffTime[10];/*發車時間*/
char receiveTime[10];/*到達時間*/
int price;/*票價*/
int bookNum ;/*票數*/
};
/*訂票人的信息*/
struct man
{
char num[10];/*ID*/
char name[10];/*姓名*/
int bookNum ;/*需求的票數*/
};
/*定義火車信息鏈表的結點結構*/
typedef struct node
{
struct train data ;
struct node * next ;
}Node,*Link ;
/*定義訂票人鏈表的結點結構*/
typedef struct people
{
struct man data ;
struct people*next ;
}bookMan,*bookManLink ;
/* 初始界面*/
void printInterface()
{
puts("********************************************************");
puts("* Welcome to use the system of booking tickets *");
puts("********************************************************");
puts("* You can choose the operation: *");
puts("* 1:Insert a train information *");
puts("* 2:Inquire a train information *");
puts("* 3:Book a train ticket *");
puts("* 4:Update the train information *");
puts("* 5:Advice to you about the train *");
puts("* 6:save information to file *");
puts("* 7:quit the system *");
puts("********************************************************");
}
/*添加一個火車信息*/
void InsertTraininfo(Link linkhead)
{
struct node *p,*r,*s ;
char num[10];
r = linkhead ;
s = linkhead->next ;
while(r->next!=NULL)
r=r->next ;
while(1)
{
printf("please input the number of the train(0-return)");
scanf("%s",num);
if(strcmp(num,"0")==0)
break ;
/*判斷是否已經存在*/
while(s)
{
if(strcmp(s->data.num,num)==0)
{
printf("the train '%s'has been born!\n",num);
return ;
}
s = s->next ;
}
p = (struct node*)malloc(sizeof(struct node));
strcpy(p->data.num,num);
printf("Input the city where the train will reach:");
scanf("%s",p->data.city);
printf("Input the time which the train take off:");
scanf("%s",p->data.takeoffTime);
printf("Input the time which the train receive:");
scanf("%s",&p->data.receiveTime);
printf("Input the price of ticket:");
scanf("%d",&p->data.price);
printf("Input the number of booked tickets:");
scanf("%d",&p->data.bookNum);
p->next=NULL ;
r->next=p ;
r=p ;
shoudsave = 1 ;
}
}
/*列印火車票信息*/
void printTrainInfo(struct node*p)
{
puts("\nThe following is the record you want:");
printf(">>number of train: %s\n",p->data.num);
printf(">>city the train will reach: %s\n",p->data.city);
printf(">>the time the train take off: %s\nthe time the train reach: %s\n",p->data.takeoffTime,p->data.receiveTime);
printf(">>the price of the ticket: %d\n",p->data.price);
printf(">>the number of booked tickets: %d\n",p->data.bookNum);
}

struct node * Locate1(Link l,char findmess[],char numorcity[])
{
Node*r ;
if(strcmp(numorcity,"num")==0)
{
r=l->next ;
while(r)
{
if(strcmp(r->data.num,findmess)==0)
return r ;
r=r->next ;
}
}
else if(strcmp(numorcity,"city")==0)
{
r=l->next ;
while(r)
{
if(strcmp(r->data.city,findmess)==0)
return r ;
r=r->next ;
}
}
return 0 ;
}

/*查詢火車信息*/
void QueryTrain(Link l)

{
Node *p ;
int sel ;
char str1[5],str2[10];
if(!l->next)
{
printf("There is not any record !");
return ;
}
printf("Choose the way:\n>>1:according to the number of train;\n>>2:according to the city:\n");
scanf("%d",&sel);
if(sel==1)
{
printf("Input the the number of train:");
scanf("%s",str1);
p=Locate1(l,str1,"num");
if(p)
{
printTrainInfo(p);
}
else
{
mark1=1 ;
printf("\nthe file can't be found!");
}
}
else if(sel==2)
{
printf("Input the city:");
scanf("%s",str2);
p=Locate1(l,str2,"city");
if(p)
{
printTrainInfo(p);
}
else
{
mark1=1 ;
printf("\nthe file can't be found!");
}
}
}

/*訂票子模塊*/
void BookTicket(Link l,bookManLink k)
{
Node*r[10],*p ;
char ch,dem ;
bookMan*v,*h ;
int i=0,t=0 ;
char str[10],str1[10],str2[10];
v=k ;
while(v->next!=NULL)
v=v->next ;
printf("Input the city you want to go: ");
scanf("%s",&str);
p=l->next ;
while(p!=NULL)
{
if(strcmp(p->data.city,str)==0)
{
r[i]=p ;
i++;
}
p=p->next ;
}
printf("\n\nthe number of record have %d\n",i);
for(t=0;t<i;t++)
printTrainInfo(r[t]);
if(i==0)
printf("\n\t\t\tSorry!Can't find the train for you!\n");
else
{
printf("\ndo you want to book it?<1/0>\n");
scanf("%d",&ch);
if(ch == 1)
{
h=(bookMan*)malloc(sizeof(bookMan));
printf("Input your name: ");
scanf("%s",&str1);
strcpy(h->data.name,str1);
printf("Input your id: ");
scanf("%s",&str2);
strcpy(h->data.num,str2);
printf("Input your bookNum: ");
scanf("%d",&dem);
h->data.bookNum=dem ;
h->next=NULL ;
v->next=h ;
v=h ;
printf("\nLucky!you have booked a ticket!");
getch();
shoudsave=1 ;
}
}
}
bookMan*Locate2(bookManLink k,char findmess[])
{
bookMan*r ;
r=k->next ;
while(r)
{
if(strcmp(r->data.num,findmess)==0)
{
mark=1 ;
return r ;
}
r=r->next ;
}
return 0 ;
}
/*修改火車信息*/
void UpdateInfo(Link l)
{
Node*p ;
char findmess[20],ch ;
if(!l->next)
{
printf("\nthere isn't record for you to modify!\n");
return ;
}
else
{
QueryTrain(l);
if(mark1==0)
{
printf("\nDo you want to modify it?\n");
getchar();
scanf("%c",&ch);
if(ch=='y');
{
printf("\nInput the number of the train:");
scanf("%s",findmess);
p=Locate1(l,findmess,"num");
if(p)
{
printf("Input new number of train:");
scanf("%s",&p->data.num);
printf("Input new city the train will reach:");
scanf("%s",&p->data.city);
printf("Input new time the train take off");
scanf("%s",&p->data.takeoffTime);
printf("Input new time the train reach:");
scanf("%s",&p->data.receiveTime);
printf("Input new price of the ticket::");
scanf("%d",&p->data.price);
printf("Input new number of people who have booked ticket:");
scanf("%d",&p->data.bookNum);
printf("\nmodifying record is sucessful!\n");
shoudsave=1 ;
}
else
printf("\t\t\tcan't find the record!");
}
}
else
mark1=0 ;
}
}
/*系統給用戶的提示信息*/
void AdvicedTrains(Link l)
{
Node*r ;
char str[10];
int mar=0 ;
r=l->next ;
printf("Iuput the city you want to go: ");
scanf("%s",str);
while(r)
{
if(strcmp(r->data.city,str)==0&&r->data.bookNum<200)
{
mar=1 ;
printf("\nyou can select the following train!\n");
printf("\n\nplease select the fourth operation to book the ticket!\n");
printTrainInfo(r);
}
r=r->next ;
}
if(mar==0)
printf("\n\t\t\tyou can't book any ticket now!\n");

}
/*保存火車信息*/
void SaveTrainInfo(Link l)
{
FILE*fp ;
Node*p ;
int count=0,flag=1 ;
fp=fopen("c:\\train.txt","wb");
if(fp==NULL)
{
printf("the file can't be opened!");
return ;
}
p=l->next ;
while(p)
{
if(fwrite(p,sizeof(Node),1,fp)==1)
{
p=p->next ;
count++;
}
else
{
flag=0 ;
break ;
}
}
if(flag)
{
printf("the number of the record which have been saved is %d\n",count);
shoudsave=0 ;
}
fclose(fp);
}
/*保存訂票人的信息*/
void SaveBookmanInfo(bookManLink k)
{
FILE*fp ;
bookMan*p ;
int count=0,flag=1 ;
fp=fopen("c:\\man.txt","wb");
if(fp==NULL)
{
printf("the file can't be opened!");
return ;
}
p=k->next ;
while(p)
{
if(fwrite(p,sizeof(bookMan),1,fp)==1)
{
p=p->next ;
count++;
}
else
{
flag=0 ;
break ;
}
}
if(flag)
{
printf("the number of the record which have been saved is %d\n",count);
shoudsave=0 ;
}
fclose(fp);
}

int main()
{
FILE*fp1,*fp2 ;
Node*p,*r ;
char ch1,ch2 ;
Link l ;
bookManLink k ;
bookMan*t,*h ;
int sel ;
l=(Node*)malloc(sizeof(Node));
l->next=NULL ;
r=l ;
k=(bookMan*)malloc(sizeof(bookMan));
k->next=NULL ;
h=k ;
fp1=fopen("c:\\train.txt","ab+");
if((fp1==NULL))
{
printf("can't open the file!");
return 0 ;
}
while(!feof(fp1))
{
p=(Node*)malloc(sizeof(Node));
if(fread(p,sizeof(Node),1,fp1)==1)
{
p->next=NULL ;
r->next=p ;
r=p ;
count1++;
}
}
fclose(fp1);
fp2=fopen("c:\\man.txt","ab+");
if((fp2==NULL))
{
printf("can't open the file!");
return 0 ;
}

while(!feof(fp2))
{
t=(bookMan*)malloc(sizeof(bookMan));
if(fread(t,sizeof(bookMan),1,fp2)==1)
{
t->next=NULL ;
h->next=t ;
h=t ;
count2++;
}
}
fclose(fp2);
while(1)
{
clrscr();
printInterface();
printf("please choose the operation: ");
scanf("%d",&sel);
clrscr();
if(sel==8)
{
if(shoudsave==1)
{
getchar();
printf("\nthe file have been changed!do you want to save it(y/n)?\n");
scanf("%c",&ch1);
if(ch1=='y'||ch1=='Y')
{
SaveBookmanInfo(k);
SaveTrainInfo(l);
}
}
printf("\nThank you!!You are welcome too\n");
break ;

}
switch(sel)
{
case 1 :
InsertTraininfo(l);break ;
case 2 :
QueryTrain(l);break ;
case 3 :
BookTicket(l,k);break ;
case 4 :
UpdateInfo(l);break ;
case 5 :
AdvicedTrains(l);break ;
case 6 :
SaveTrainInfo(l);SaveBookmanInfo(k);break ;
case 7 :
return 0;
}
printf("\nplease press any key to continue.......");
getch();
}
return 0;
}

『叄』 抖音小程序開發

Java仿抖音短視頻小程序開發 全棧式實戰項目免費下載

鏈接:https://pan..com/s/1K0b-jeL6U7kolcKSwZL2Yw

提取碼:85xy

Java仿抖音短視頻小程序開發源碼(仿抖音短視頻程序開發)是很好用的仿抖音短視頻小程序開發的源碼。Java仿抖音短視頻小程序開發源碼功能強大,使用簡便,給用戶帶來很多開發便利

『肆』 開發一個簡易的計算器APP程序 Android源代碼

下面是效果展示:

復制代碼代碼如下:


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="s/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tvResult"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:height="50dp"
android:text="@string/tvResult"
/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/btnBackspace"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="150dp"
android:layout_marginLeft="10dp"
android:text="@string/btnbackspace"/>
<Button
android:id="@+id/btnCE"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="150dp"
android:text="@string/btnCE"/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/btn7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:width="75dp"
android:text="@string/btn7"/>
<Button
android:id="@+id/btn8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btn8"/>
<Button
android:id="@+id/btn9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btn9"/>
<Button
android:id="@+id/btnDiv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btnDiv"/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/btn4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:width="75dp"
android:text="@string/btn4"/>
<Button
android:id="@+id/btn5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btn5"/>
<Button
android:id="@+id/btn6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btn6"/>
<Button
android:id="@+id/btnMul"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btnMul"/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:width="75dp"
android:text="@string/btn1"/>
<Button
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btn2"/>
<Button
android:id="@+id/btn3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btn3"/>
<Button
android:id="@+id/btnAdd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btnAdd"/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/btn0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:width="75dp"
android:text="@string/btn0"/>
<Button
android:id="@+id/btnC"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btnC"/>
<Button
android:id="@+id/btnEqu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btnEqu"/>
<Button
android:id="@+id/btnSub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btnSub"/>
</LinearLayout>
</LinearLayout>

復制代碼代碼如下:


package com.example.week2;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.app.Activity;

public class MainActivity extends Activity implements OnClickListener{

//聲明一些控制項
Button btn0=null;
Button btn1=null;
Button btn2=null;
Button btn3=null;
Button btn4=null;
Button btn5=null;
Button btn6=null;
Button btn7=null;
Button btn8=null;
Button btn9=null;
Button btnBackspace=null;
Button btnCE=null;
Button btnC=null;
Button btnAdd=null;
Button btnSub=null;
Button btnMul=null;
Button btnDiv=null;
Button btnEqu=null;
TextView tvResult=null;
//聲明兩個參數。接收tvResult前後的值
double num1=0,num2=0;
double Result=0;//計算結果
int op=0;//判斷操作數,
boolean isClickEqu=false;//判斷是否按了「=」按鈕

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//從布局文件中獲取控制項,
btn0=(Button)findViewById(R.id.btn0);
btn1=(Button)findViewById(R.id.btn1);
btn2=(Button)findViewById(R.id.btn2);
btn3=(Button)findViewById(R.id.btn3);
btn4=(Button)findViewById(R.id.btn4);
btn5=(Button)findViewById(R.id.btn5);
btn6=(Button)findViewById(R.id.btn6);
btn7=(Button)findViewById(R.id.btn7);
btn8=(Button)findViewById(R.id.btn8);
btn9=(Button)findViewById(R.id.btn9);
btnBackspace=(Button)findViewById(R.id.btnBackspace);
btnCE=(Button)findViewById(R.id.btnCE);
btnC=(Button)findViewById(R.id.btnC);
btnEqu=(Button)findViewById(R.id.btnEqu);
btnAdd=(Button)findViewById(R.id.btnAdd);
btnSub=(Button)findViewById(R.id.btnSub);
btnMul=(Button)findViewById(R.id.btnMul);
btnDiv=(Button)findViewById(R.id.btnDiv);
tvResult=(TextView)findViewById(R.id.tvResult);

//添加監聽
btnBackspace.setOnClickListener(this);
btnCE.setOnClickListener(this);

btn0.setOnClickListener(this);
btn1.setOnClickListener(this);
btn2.setOnClickListener(this);
btn3.setOnClickListener(this);
btn4.setOnClickListener(this);
btn5.setOnClickListener(this);
btn6.setOnClickListener(this);
btn7.setOnClickListener(this);
btn8.setOnClickListener(this);
btn9.setOnClickListener(this);


btnAdd.setOnClickListener(this);
btnSub.setOnClickListener(this);
btnMul.setOnClickListener(this);
btnDiv.setOnClickListener(this);
btnEqu.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
//btnBackspace和CE--------------------
case R.id.btnBackspace:
String myStr=tvResult.getText().toString();
try {
tvResult.setText(myStr.substring(0, myStr.length()-1));
} catch (Exception e) {
tvResult.setText("");
}

break;
case R.id.btnCE:
tvResult.setText(null);
break;

//btn0--9---------------------------
case R.id.btn0:
if(isClickEqu)
{
tvResult.setText(null);
isClickEqu=false;
}
String myString=tvResult.getText().toString();
myString+="0";
tvResult.setText(myString);
break;
case R.id.btn1:
if(isClickEqu)
{
tvResult.setText(null);
isClickEqu=false;
}
String myString1=tvResult.getText().toString();
myString1+="1";
tvResult.setText(myString1);
break;
case R.id.btn2:
if(isClickEqu)
{
tvResult.setText(null);
isClickEqu=false;
}
String myString2=tvResult.getText().toString();
myString2+="2";
tvResult.setText(myString2);
break;
case R.id.btn3:
if(isClickEqu)
{
tvResult.setText(null);
isClickEqu=false;
}
String myString3=tvResult.getText().toString();
myString3+="3";
tvResult.setText(myString3);
break;
cas

『伍』 源代碼到底是什麼有什麼用

源代碼就是用匯編語言和高級語言寫出來的代碼。主要對象是面向開發者;
我們平常使用的應用程序都是經過源碼編譯打包以後發布的,呈現的最後結果是面向使用者,最終客戶的。

1.理論上的概念
源代碼是相對目標代碼和可執行代碼而言的。
源代碼就是用匯編語言和高級語言寫出來的代碼。
目標代碼是指源代碼經過編譯程序產生的能被cpu直接識別二進制代碼。
可執行代碼就是將目標代碼連接後形成的可執行文件,當然也是二進制的。
2.最直觀的概念
在這個網頁上右鍵滑鼠,選擇查看源文件.出來一個記事本,裡面的內容就是此網頁的源代碼.
===================================================
關於兩者的區別聯系:
1.從字面意義上來講,源文件是指一個文件,指源代碼的集合.源代碼則是一組具有特定意義的可以實現特定功能的字元(程序開發代碼).
2."源代碼"在大多數時候等於"源文件".
比如在這個網頁上右鍵滑鼠,選擇查看源文件.出來一個記事本,裡面的內容就是此網頁的源代碼."這句話就體現了他們的關系,此處的源文件是指網頁的源文件,而源代碼就是源文件的內容,所以又可以稱做網頁的源代碼..

『陸』 什麼是源代碼

源代碼是用特定編程語言編寫的人類可讀文本,源代碼的目標是為可以轉換為機器語言的計算機設置准確的規則和規范。因此,源代碼是程序和網站的基礎。

源代碼可以存在於每個軟體中,軟體按照源代碼中的編程進行執行,常用的格式是文本文件,計算機源代碼的最終目的是將人類可讀的文本翻譯成為計算機可以執行的二進制指令,這種過程叫做編譯,通過編譯器完成。

(6)程序開發範例寶典源碼擴展閱讀:

概念研究

一、理論上的概念

源代碼是相對目標代碼和可執行代碼而言的。

源代碼就是用匯編語言和高級語言寫出來的代碼。

目標代碼是指源代碼經過編譯程序產生的能被cpu直接識別的二進制代碼。

可執行代碼就是將目標代碼連接後形成的可執行文件,當然也是二進制的。

二、最直觀的概念

在這個網頁上右鍵滑鼠,選擇"查看源文件".出來一個記事本,裡面的內容就是此網頁的源代碼.

關於兩者的區別聯系:

1、從字面意義上來講,源文件是指一個文件,指源代碼的集合。源代碼則是一組具有特定意義的可以實現特定功能的字元(程序開發代碼).

2、"源代碼"在大多數時候等於"源文件".

比如在這個網頁上右鍵滑鼠,選擇查看源文件。出來一個記事本,裡面的內容就是此網頁的源代碼."這句話就體現了他們的關系,此處的源文件是指網頁的源文件,而源代碼就是源文件的內容,所以又可以稱做網頁的源代碼。.

源代碼是指原始代碼,可以是任何語言代碼。

匯編碼是指源代碼編譯後的代碼,通常為二進制文件,比如DLL、EXE、.NET中間代碼、JAVA中間代碼等。

高級語言通常指C/C++、BASIC、C#、JAVA、PASCAL等等匯編語言就是ASM,只有這個,比這個更低級的就是機器語言了。

源程序源文件源代碼是一回事。

參考資料來源:網路-源代碼

閱讀全文

與程序開發範例寶典源碼相關的資料

熱點內容
槍神紀母猴飛天教程 瀏覽:516
快捷建立文件夾 瀏覽:477
exe視頻文件沒有注冊類 瀏覽:451
unix批量刪除文件名前綴 瀏覽:541
k750s升級bios 瀏覽:147
學韓語用什麼app 瀏覽:478
110固態硬碟分區win10 瀏覽:317
怎麼恢復系統文件 瀏覽:358
數據線轉換器多少錢 瀏覽:274
美國隊長qq皮膚多少錢 瀏覽:630
win8word文檔在哪 瀏覽:180
甘肅省人事局文件在哪裡 瀏覽:689
spss安裝輸入代碼 瀏覽:546
網路語言知乎 瀏覽:596
iphoneicloud無法顯示 瀏覽:112
ict程序包 瀏覽:729
java有哪些條件語句 瀏覽:345
冒險島120級去哪裡升級 瀏覽:511
手機輸入法聲音文件 瀏覽:876
下劃線哪個app 瀏覽:48

友情鏈接