原创 Shell Sort 希爾排序

希爾排序(Shell Sort)又叫做縮小增量排序(diminishing increment sort),是一種很優秀的排序法,算法本身不難理解,也很容易實現,而且它的速度很快。 插入排序(Insertion Sort)的一個重要的特點

原创 #define 引發的問題

1。#include <stdio.h> #define square(x) x*x int main() { int v; scanf("%d",&v); printf("%d/n",square(v+1));

原创 getline() vector

#include<iostream> #include<vector> #include<string> using namespace std; int main() { int NUM; cout<<"input vetcor s

原创 double 和 long double

double和long double都是ANSI C標準的浮點數。但ANSI C並未規定long double的確切精度。所以對於不同平臺可能有不同的實現。有的是8字節,有的是10字節,有的是12字節或更多。一般來說long double

原创 程序員的八個級別

在面試時,你可能會被經常問到“在未來5年,你想幹什麼?”,這可能是一個比較難回答的問題。在中國,答案一般可能會是Team leader,Manager,或是Architect,Specialist等,在中國,大家可能更多地覺得manage

原创 Timeline of programming languages

Predecessor(s) Year Name Chief developer, Company Pre 1950 * ~1837 Analytical Engine order code Charles Babbage and A

原创 如何優化C語言代碼

[轉帖]如何優化C語言代碼 作者 huchengxtu 日期 2009-8-1 12:10:00 1、選擇合適的算法和數據結構   應該熟悉算法語言,知道各種算法的優缺點,具體資料請參見相應的參考資料,有很多計算機書籍上都有介紹。

原创 一個老電子工程師對新工程師的挖心話

諸位,咱當電子工程師也是十餘年了,不算有出息,環顧四周,也沒有看見幾個有出息的!回顧工程師生涯,感慨萬千,願意講幾句掏心窩子的話,也算給咱們師弟師妹們提個醒,希望他們比咱們強!   [1]好好規劃自己的路,不要跟着感覺走!根據個人的理想決

原创 string類的成員函數c_str()

#include <iostream> #include <string> using namespace std; int main() { char * a ="Hello world!/n"; string c=a;

原创 C語言中用qsort()快速排序

C語言中排序的算法有很多種,系統也提供了一個函數qsort()可以實現快速排序。原型如下:   void qsort ( void * base, size_t nmem, size_t size, int ( * comp) (

原创 字符串與整數之間的轉換

#include <iostream> #include <stdlib.h> using namespace std; int main() { string s="12345"; long int i=strtol(s

原创 函數指針

#include <stdio.h> #include <stdlib.h> void fun() { printf("Here/n"); } int main() { void (

原创 十進制轉2-16進制

#include <iostream> #include <stdio.h> #include <stack> #include <assert.h> using namespace std; int main() { char digi

原创 關於time_t,clock_t ,time(),clock(),CLK_TCK, CLOCKS_PER_SEC 的使用

ISO/IEC     9899:1999     標準中有一個宏:     CLOCKS_PER_SEC       <1>     tc2     中的     time.h:沒有     CLOCKS_PER_SEC,有一個    

原创 C語言變量名

A N S I標準規定,標識符可以爲任意長度,但外部名必須至少能由前6個字符唯一地區分,並且不區分大小寫。這裏外部名指的是在鏈接過程中所涉及的標識符,其中包括文件間共享的函數名和全局變量名。  A N S I標準還規定內部名必須至少能由前