Time of Update: 2018-12-07
一次for迴圈完成1!+2!+...+10!.cmain(){long s=0,n=1;int i;for(i=1;i<=10;i++) { n=n*i; s=s+n; } printf("s=%ld\n",s);}楊輝三角.cmain(){int a[10][10], x, y;for(x=0;x<10;x++)for(y=0;y<10;y++) a[x][y]=0;for(x=0;x<10;x++) a[x][
Time of Update: 2018-12-07
Time of Update: 2018-12-07
1. 環境 /usr/local/apache/htdocs/ (待檢索的檔案在該目錄下) /usr/local/apache/temp/ (作為中轉的檔案夾) /usr/local/apache/cgi-bin/ 2. 將gcc search.c產生的a.out放置在/usr/local/apache/cgi-bin/中,使用權限設定為nobody可 以執行。 3. chown -R nobody.nobody /usr/local/apache/temp 4.
Time of Update: 2018-12-07
代碼如下:/*本例用於測試C語言實現二維數組的建立、輸出和記憶體釋放結論:二維數組只適合數組元素個數確定的情況,如果元素個數不確定,最好是用鏈表。*/#include <stdio.h>#include <stdlib.h>#include <string.h>#define N 5// 建立並初始化二維數組char** get2DArray(int n){int i = 0;char temp[256] = {0};char **p =
Time of Update: 2018-12-07
開發環境:fedora12 + oracle-client11 + eclipse目標資料庫:oracle10g一、準備1. 建表Create Table testTable_OCI( SID int primary key, Seq varchar2(10), UName varchar2(20), Introduce VARCHAR2(200
Time of Update: 2018-12-07
本來我用的是這樣的程式# include <iostream.h>int main(void){ int i,j; j=0; i=j+1; cout<<"hello world!"<<endl; cout<<"the result is"<<i<<endl; return 0;}利用g++ -o test test.cpp。但是這樣是有錯誤的,提示無法開啟iostream.h,修改成這樣的程式# include
Time of Update: 2018-12-07
/*功能:實現檔案編碼格式的判斷通過一個檔案的最前面三個位元組,可以判斷出該的編碼類別型:ANSI: 無格式定義;(第一個位元組開始就是檔案內容)Unicode: 前兩個位元組為FFFE;Unicode big endian: 前兩位元組為FEFF; UTF-8: 前兩位元組為EFBB,第三位元組為BF*/#include <stdio.h>#include <stdlib.h>#include <string.h>/
Time of Update: 2018-12-07
/*功能:擷取當前系統時間傳回值:0-成功,-1-失敗out:儲存返回的系統時間,格式由fmt決定fmt:0-返回:yyyy-mm-dd hh24:mi:ss, 1-返回:yyyy-mm-dd, 2-返回:hh24:mi:ss*/int getTime(char *out, int fmt)// 擷取當前系統時間{if(out == NULL)return -1;time_t t;struct tm *tp;t = time(NULL);tp =
Time of Update: 2018-12-07
printf()函數是格式輸出函數,請求printf()列印變數的指令取決與變數的類型.例如,在列印整數是使用%d符號,在列印字元是用%c 符號.這些符號被稱為轉換說明.因為它們指定了如何不資料轉換成可顯示的形式.下列列出的是ANSI C標準peintf()提供的各種轉換說明. 轉換說明及作為結果的列印輸出%a
Time of Update: 2018-12-07
From: http://maxim.eefocus.com/xuefu2009/blog/10-03/187348_f456a.html包含檔案:#ifndef __TIME_T#define __TIME_T /* 避免重複定義 time_t */typedef long time_t; /* 時間值time_t 為長整型的別名*/#endif 既
Time of Update: 2018-12-07
首先在FormCreate時調用DragAcceptFiles(this,true)註冊你的程式,使得你的程式可以接受檔案的DragDrop。然後處理WM_DROPFILES訊息,獲得DropDrag的訊息,調用如下函數獲得相關的參數::UINT DragQueryFile( HDROP hDrop, UINT iFile, LPTSTR lpszFile, UINT cch);BOOL DragQueryPoint( HDROP
Time of Update: 2018-12-07
一、簡介:1.檔案包含:程式中所有用到的函數、類型、宏都在如下檔案中包含:#include
Time of Update: 2018-12-07
庫函數是高層的,完全運行在使用者空間,為程式員提供調用真正的在幕後完成實際事務的系統調用的更方便的介面。系統調用在核心態運行並且由核心自己提供。標準C庫函數printf()可以被看做是一個通用的輸出語句,但它實際做的是將資料轉化為符合格式的字串並且調用系統調用 write()輸出這些字串。是否想看一看printf()究竟使用了哪些系統調用? 這很容易,編譯下面的代碼。#include <stdio.h>int main(void){ printf("hello");
Time of Update: 2018-12-07
《Expert C Programming》(《C專家編程》)中提到C語言聲明的優先順序規則如下: A 聲明從它的名字開始讀取,然後按照優先順序順序依次讀取; B 優先順序從高到低依次是: B.1 聲明中被括弧括起來的那部分; B.2 尾碼操作符:括弧()表示這是一個函數,而方括弧[]表示這是一個數組; B.3 首碼操作符:星號*標識“指向……的指標”; C
Time of Update: 2018-12-07
(申明:此文章屬於原創,若轉載請表明作者和原處連結 ) /* author: wu.jian (吳劍) English name:
Time of Update: 2018-12-07
很多人都苦惱於如何在子表單中操作主表單上的控制項,或者在主表單中操作子表單上的控制項。相比較而言,後面稍微簡單一些,只要在主表單中建立子表單的時候,保留所建立子表單對象即可。 下面重點介紹前一種,目前常見的有兩種方法,基本上大同小異: 第一種,在主表單類中定義一個靜態成員,來儲存當前主表單對象,例如: public static yourMainWindow pCurrentWin = null; 然後在主表單建構函式中,給靜態成員初始化,如下: pCurrentWin =
Time of Update: 2018-12-07
C++builder編程修改註冊表的問題2000-08-16 14:11:52RootKey是註冊表的根索引值,比如運行regedit後看到的HKEY_USERS,HKEY_LOCAL_MACHINE就是RootKey,在TRegIniFile中預設的RootKey是HKEY_USERS. 下面的例子是TRegistry的,TRegIniFile也差不多 void __fastcall TfrmMainForm::WriteToMyRegistry(int table_count) { //
Time of Update: 2018-12-07
相關函數:index, memchr, rindex, strpbrk, strsep, strspn, strstr表標頭檔:#include <string.h>C/C++中的Split函數是strtok()其函數原型如下: char * strtok (char * str, const char * delimiters); 函數說明
Time of Update: 2018-12-07
#include <stdio.h> #include <dos.h> #include <time.h> #define LSB 0 #define MSB 1 #define RXR 0 #define TXR 0 #define IER 1 #define IIR 2 #define LCR 3 #define MCR 4 #define LSR 5 #define MSR 6 #define Com1_base 0x3f8 #define uchar
Time of Update: 2018-12-07
1、求二個數的最大公約數:#include <iostream.h>int maxye(int a,int b){int temp;while(a%b){ temp=b; b=a%b; a=temp;}return b;}void main(){int aa,bb;cout<<"請輸入第一個數:";cin>>aa;cout<<"