C语言
-
C实例逆序拷贝数组-C语言实例教程|
C实例 逆序拷贝数组 #include stdio.h int main () { int original [ 10 ] = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 }; int copied [ 10 ]; int loop , count ; count = 9 ; for ( lo...
-
C语言strcmp实例-C语言基础教程实例源码|
C语言strcmp实例 /* quit_chk.c -- beginning of some program */ #include stdio.h #include string.h #define SIZE 80 #define LIM 10 #define STOP quit char * s_gets ( char * st , int...
-
C实例拷贝数组到另外一个-C语言实例教程|
C实例 拷贝数组到另外一个 #include stdio.h int main () { int original [ 10 ] = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 }; int copied [ 10 ]; int loop ; for ( loop = 0 ; lo...
-
C实例找出数组的最小值-C语言实例教程|
C实例 找出数组的最小值 #include stdio.h int main () { int array [ 10 ] = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 }; int loop , smallest ; smallest = array [ 0 ]; for ( loo...
-
C语言strcmp函数实例-C语言基础教程实例源码|
C语言strcmp函数实例 /* nogo.c -- will this work? */ #include stdio.h #define ANSWER Grant #define SIZE 40 char * s_gets ( char * st , int n ); int main ( void ) { char try [ S...
-
C实例第二大数组-C语言实例教程|
C实例 第二大数组 #include stdio.h int main () { int array [ 10 ] = { 101 , 11 , 3 , 4 , 50 , 69 , 7 , 8 , 9 , 0 }; int loop , largest , second ; if ( array [ 0 ] array [ 1 ])...
-
C语言strncat实例-C语言基础教程实例源码|
C语言strncat实例 /* join_chk.c -- joins two strings, check size first */ #include stdio.h #include string.h #define SIZE 30 #define BUGSIZE 13 char * s_gets ( char * st , int n ...
-
C实例找出数组元素的最大值-C语言实例教程|
C实例 找出数组元素的最大值 #include stdio.h int main () { int array [ 10 ] = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 }; int loop , largest ; largest = array [ 0 ]; for (...
-
C语言strcat函数实例-C语言基础教程实例源码|
C语言strcat函数实例 /* str_cat.c -- joins two strings */ #include stdio.h #include string.h /* declares the strcat() function */ #define SIZE 80 char * s_gets ( char * st , in...
-
C实例计算数组的均值-C语言实例教程|
C实例 计算数组的均值 #include stdio.h int main () { int array [ 10 ] = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 }; int sum , loop ; float avg ; sum = avg = 0 ; for ( loop = ...
-
C语言strlen函数实例-C语言基础教程实例源码|
C语言strlen函数实例 /* test_fit.c -- try the string-shrinking function */ #include stdio.h #include string.h /* contains string function prototypes */ void fit ( char * , unsi...
-
C实例打印数组之和-C语言实例教程|
C实例 打印数组之和 #include stdio.h int main () { int array [ 10 ] = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 }; int sum , loop ; sum = 0 ; for ( loop = 9 ; loop = 0 ; loop -...
-
C语言自定义输入输出函数-C语言基础教程实例源码|
C语言自定义输入输出函数 //put_put.c -- user-defined output functions #include stdio.h void put1 ( const char * ); int put2 ( const char * ); int main ( void ) { put1 ( If...
-
C实例逆序打印数组-C语言实例教程|
C实例 逆序打印数组 #include stdio.h int main () { int array [ 10 ] = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 }; int loop ; for ( loop = 9 ; loop = 0 ; loop -- ) printf ( %d ...
-
C语言puts函数用法-C语言基础教程实例源码|
C语言puts函数用法 /* nono.c -- no! */ #include stdio.h int main ( void ) { char side_a [] = Side A ; char dont [] = { W , O , W , ! }; char side_b [] = Side B ; puts ( dont );...
-
C实例打印数组-C语言实例教程|
C实例 打印数组 #include stdio.h int main () { int array [ 10 ] = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 }; int loop ; for ( loop = 0 ; loop 10 ; loop ++ ) printf ( %d , array...
-
C语言scanf函数用法-C语言基础教程实例源码|
C语言scanf函数用法 /* scan_str.c -- using scanf() */ #include stdio.h int main ( void ) { char name1 [ 11 ], name2 [ 11 ]; int count ; printf ( Please enter 2 names. ); count ...
-
C实例帕斯卡三角-C语言实例教程|
C实例 帕斯卡三角 #include stdio.h int factorial ( int n ) { int f ; for ( f = 1 ; n 1 ; n -- ) f *= n ; return f ; } int ncr ( int n , int r ) { return factorial ( n ) / ( fa...
-
C实例弗洛伊德三角-C语言实例教程|
C实例 弗洛伊德三角 #include stdio.h int main () { int n , i , j , k = 1 ; n = 5 ; for ( i = 1 ; i = n ; i ++ ) { for ( j = 1 ; j = i ; j ++ ) printf ( %3d , k ++ ); printf (...
-
C示例自上而下右三角打印-C语言实例教程|
C示例自上而下右三角打印 #include stdio.h int main () { int n , i , j ; n = 5 ; for ( i = n ; i = 1 ; i -- ) { for ( j = 1 ; j = i ; j ++ ) printf ( * ); printf ( ); } ret...