C语言
-
C语言循环实例1-C语言基础教程实例源码|
C语言循环实例1 /* shoes1.c -- converts a shoe size to inches */ #include stdio.h #define ADJUST 7.31 // one kind of symbolic constant int main ( void ) { const double SCALE = ...
-
C库函数strrchr()-C语言实例教程|
C库函数 strrchr() #include stdio.h #include string.h int main () { int len ; const char str [] = http://www.codingdict.com ; const char ch = . ; char * ret ; ret = strrchr ( str ...
-
C语言字符串格式化实例-C语言基础教程实例源码|
C语言字符串格式化实例 /* stringf.c -- string formatting */ #include stdio.h #define BLURB Authentic imitation! int main ( void ) { printf ( [%2s] , BLURB ); printf ( [%24s...
-
C库函数strpbrk()-C语言实例教程|
C库函数 strpbrk() #include stdio.h #include string.h int main () { const char str1 [] = abcde2fghi3jk4l ; const char str2 [] = 34 ; char * ret ; ret = strpbrk ( str1 , str2 ); if...
-
C语言跳过输入字符实例-C语言基础教程实例源码|
C语言跳过输入字符实例 /* skiptwo.c -- skips over first two integers of input */ #include stdio.h int main ( void ) { int n ; printf ( Please enter three integers: ); scanf...
-
C库函数strlen()-C语言实例教程|
C库函数 strlen() #include stdio.h #include string.h int main () { char str [ 50 ]; int len ; strcpy ( str , This is codingdict.com ); len = strlen ( str ); printf ( Length of |%s...
-
C语言使用变宽输出字段-C语言基础教程实例源码|
C语言使用变宽输出字段 /* varwid.c -- uses variable-width output field */ #include stdio.h int main ( void ) { unsigned width , precision ; int number = 256 ; double weight...
-
C库函数strerror()-C语言实例教程|
C库函数 strerror() #include stdio.h #include string.h #include errno.h int main () { FILE * fp ; fp = fopen ( file.txt , r ); if ( fp == NULL ) { printf ( Error: %s , strerror ( ...
-
C语言scanf函数实例-C语言基础教程实例源码|
C语言scanf函数实例 // input.c -- when to use #include stdio.h int main ( void ) { int age ; // variable float assets ; // variable char pet [ 30 ]; // string printf ( Enter yo...
-
C库函数strcspn()-C语言实例教程|
C库函数 strcspn() #include stdio.h #include string.h int main () { int len ; const char str1 [] = ABCDEF4960910 ; const char str2 [] = 013 ; len = strcspn ( str1 , str2 ); printf...
-
C库函数strncpy()-C语言实例教程|
C库函数 strncpy() #include stdio.h #include string.h int main () { char src [ 40 ]; char dest [ 12 ]; memset ( dest , � , sizeof ( dest )); strcpy ( src , This is codingdict.co...
-
C库函数strcpy()-C语言实例教程|
C库函数 strcpy() #include stdio.h #include string.h int main () { char src [ 40 ]; char dest [ 100 ]; memset ( dest , � , sizeof ( dest )); strcpy ( src , This is codingdict.co...
-
C语言打印长字符串实例-C语言基础教程实例源码|
C语言打印长字符串实例 /* longstrg.c printing long strings */ #include stdio.h int main ( void ) { printf ( Heres one way to print a ); printf ( long string. ); printf ( He...
-
C语言printf函数返回值实例-C语言基础教程实例源码|
C语言printf函数返回值实例 /* prntval.c -- finding printf()s return value */ #include stdio.h int main ( void ) { int bph2o = 212 ; int rv ; rv = printf ( %d F is waters boi...
-
C语言不匹配的浮点类型转换-C语言基础教程实例源码|
C语言不匹配的浮点类型转换 /* floatcnv.c -- mismatched floating-point conversions */ #include stdio.h int main ( void ) { float n1 = 3.0 ; double n2 = 3.0 ; long n3 = 200...
-
C语言不匹配的整型转换实例-C语言基础教程实例源码|
C语言不匹配的整型转换实例 /* intconv.c -- some mismatched integer conversions */ #include stdio.h #define PAGES 336 #define WORDS 65618 int main ( void ) { short num = P...
-
C语言格式标记实例-C语言基础教程实例源码|
C语言格式标记实例 /* flags.c -- illustrates some formatting flags */ #include stdio.h int main ( void ) { printf ( %x %X %#x , 31 , 31 , 31 ); printf ( **%d**% d**% d** , 42...
-
C库函数strcoll()-C语言实例教程|
C库函数 strcoll() #include stdio.h #include string.h int main () { char str1 [ 15 ]; char str2 [ 15 ]; int ret ; strcpy ( str1 , abc ); strcpy ( str2 , ABC ); ret = strcoll ( str...
-
C语言格式化输出修饰符组合实例-C语言基础教程实例源码|
C语言格式化输出修饰符组合实例 // floats.c -- some floating-point combinations #include stdio.h int main ( void ) { const double RENT = 3852.99 ; // const-style constan...
-
C库函数strncmp()-C语言实例教程|
C库函数 strncmp() #include stdio.h #include string.h int main () { char str1 [ 15 ]; char str2 [ 15 ]; int ret ; strcpy ( str1 , abcdef ); strcpy ( str2 , ABCDEF ); ret = strncmp...