C语言
-
C语言语句实例-C语言基础教程实例源码|
C语言语句实例 /* addemup.c -- five kinds of statements */ #include stdio.h int main ( void ) /* finds sum of first 20 integers */ { int count , sum ; /* declaration statement ...
-
C库函数gmtime()-C语言实例教程|
C库函数 gmtime() #include stdio.h #include time.h #define BST (+1) #define CCT (+8) int main () { time_t rawtime ; struct tm * info ; time ( rawtime ); /* Get GMT time */ info = ...
-
C语言自减运算符实例-C语言基础教程实例源码|
C语言自减运算符实例 #include stdio.h #define MAX 100 int main ( void ) { int count = MAX + 1 ; while ( -- count 0 ) { printf ( %d bottles of spring water on the wall, %d bo...
-
C库函数difftime()-C语言实例教程|
C库函数 difftime() #include stdio.h #include time.h int main () { time_t start_t , end_t ; double diff_t ; printf ( Starting of the program... ); time ( start_t ); printf ( Sleep...
-
C语言自增前缀后缀实例-C语言基础教程实例源码|
C语言自增前缀后缀实例 /* post_pre.c -- postfix vs prefix */ #include stdio.h int main ( void ) { int a = 1 , b = 1 ; int a_post , pre_b ; a_post = a ++ ; // value of a++ d...
-
C库函数ctime()-C语言实例教程|
C库函数 ctime() #include stdio.h #include time.h int main () { time_t curtime ; time ( curtime ); printf ( Current time = %s , ctime ( curtime )); return ( 0 ); }...
-
C语言自增运算符实例-C语言基础教程实例源码|
C语言自增运算符实例 /* add_one.c -- incrementing: prefix and postfix */ #include stdio.h int main ( void ) { int ultra = 0 , super = 0 ; while ( super 5 ) { super ++ ; ++ u...
-
C库函数clock()-C语言实例教程|
C库函数 clock() #include time.h #include stdio.h int main () { clock_t start_t , end_t , total_t ; int i ; start_t = clock (); printf ( Starting of the program, start_t = %ld , s...
-
C语言求模运算实例-C语言基础教程实例源码|
C语言求模运算实例 // min_sec.c -- converts seconds to minutes and seconds #include stdio.h #define SEC_PER_MIN 60 // seconds in a minute int main ( void ) { int sec , min , ...
-
C库函数asctime()-C语言实例教程|
C库函数 asctime() #include stdio.h #include string.h #include time.h int main () { struct tm t ; t . tm_sec = 10 ; t . tm_min = 10 ; t . tm_hour = 6 ; t . tm_mday = 25 ; t . tm_m...
-
C语言sizeof运算符-C语言基础教程实例源码|
C语言sizeof运算符 // sizeof.c -- uses sizeof operator // uses C99 %z modifier -- try %u or %lu if you lack %zd #include stdio.h int main ( void ) { int n = 0 ; size_t intsize ;...
-
C库函数strxfrm()-C语言实例教程|
C库函数 strxfrm() #include stdio.h #include string.h int main () { char dest [ 20 ]; char src [ 20 ]; int len ; strcpy ( src , Tutorials Point ); len = strxfrm ( dest , src , 20 ...
-
C语言运算符优先级-C语言基础教程实例源码|
C语言运算符优先级 /* rules.c -- precedence test */ #include stdio.h int main ( void ) { int top , score ; top = score = - ( 2 + 5 ) * 6 + ( 4 + 3 * ( 2 + 3 )); printf ( top ...
-
C语言除法运算符实例-C语言基础教程实例源码|
C语言除法运算符实例 /* divide.c -- divisions we have known */ #include stdio.h int main ( void ) { printf ( integer division: 5/4 is %d , 5 / 4 ); printf ( integer division...
-
C语言乘法运算符实例-C语言基础教程实例源码|
C语言乘法运算符实例 /* wheat.c -- exponential growth */ #include stdio.h #define SQUARES 64 // squares on a checkerboard int main ( void ) { const double CROP = 2E16 ; // w...
-
C库函数strtok()-C语言实例教程|
C库函数 strtok() #include string.h #include stdio.h int main () { char str [ 80 ] = This is - www.codingdict.com - website ; const char s [ 2 ] = - ; char * token ; /* get the fi...
-
C语言赋值实例-C语言基础教程实例源码|
C语言赋值实例 /* golf.c -- golf tournament scorecard */ #include stdio.h int main ( void ) { int jane , tarzan , cheeta ; cheeta = tarzan = jane = 68 ; printf ( cheeta tarzan ...
-
C库函数strstr()-C语言实例教程|
C库函数 strstr() #include stdio.h #include string.h int main () { const char haystack [ 20 ] = CodingDict ; const char needle [ 10 ] = Point ; char * ret ; ret = strstr ( haystac...
-
C语言循环实例2-C语言基础教程实例源码|
C语言循环实例2 /* shoes2.c -- calculates foot lengths for several sizes */ #include stdio.h #define ADJUST 7.31 // one kind of symbolic constant int main ( void ) { const doub...
-
C库函数strspn()-C语言实例教程|
C库函数 strspn() #include stdio.h #include string.h int main () { int len ; const char str1 [] = ABCDEFG019874 ; const char str2 [] = ABCD ; len = strspn ( str1 , str2 ); printf ...