C语言
-
C实例立方根-C语言实例教程|
C实例 立方根 #include stdio.h double cubeRoot ( double n ) { double i , precision = 0.000001 ; for ( i = 1 ; ( i * i * i ) = n ; ++ i ); //Integer part for ( -- i ; ( i * i * i...
-
C语言复合字面量实例-C语言基础教程实例源码|
C语言复合字面量实例 /* complit.c -- compound literals */ #include stdio.h #define MAXTITL 41 #define MAXAUTL 31 struct book { // structure template: tag is book char title ...
-
C示例查找多维数据集的程序-C语言实例教程|
C示例查找多维数据集的程序 #include stdio.h int main () { int n = 5 ; printf ( Cube of %d = %d , n , ( n * n * n )); return 0 ; }...
-
C语言使用指针和malloc函数实例-C语言基础教程实例源码|
C语言使用指针和malloc函数实例 // names3.c -- use pointers and malloc() #include stdio.h #include string.h // for strcpy(), strlen() #include stdlib.h // for malloc(), fre...
-
C语言传递并返回结构实例-C语言基础教程实例源码|
C语言传递并返回结构实例 /* names2.c -- passes and returns structures */ #include stdio.h #include string.h #define NLEN 30 struct namect { char fname [ NLEN ]; char lname...
-
C语言使用指向结构的指针-C语言基础教程实例源码|
C语言使用指向结构的指针 /* names1.c -- uses pointers to a structure */ #include stdio.h #include string.h #define NLEN 30 struct namect { char fname [ NLEN ]; char lname ...
-
C语言传递结构实例-C语言基础教程实例源码|
C语言传递结构实例 /* funds3.c -- passing a structure */ #include stdio.h #define FUNDLEN 50 struct funds { char bank [ FUNDLEN ]; double bankfund ; char save [ FUNDLEN ]; do...
-
C语言传递结构的地址-C语言基础教程实例源码|
C语言传递结构的地址 /* funds2.c -- passing a pointer to a structure */ #include stdio.h #define FUNDLEN 50 struct funds { char bank [ FUNDLEN ]; double bankfund ; char save...
-
C示例平方根程序-C语言实例教程|
C示例平方根程序 #include stdio.h double squareRoot ( double n ) { double i , precision = 0.00001 ; for ( i = 1 ; i * i = n ; ++ i ); //Integer part for ( -- i ; i * i n ; i +...
-
C实例计算模式-C语言实例教程|
C实例 计算模式 #include stdio.h int mode ( int a [], int n ) { int maxValue = 0 , maxCount = 0 , i , j ; for ( i = 0 ; i n ; ++ i ) { int count = 0 ; for ( j = 0 ; j n ; ++ j ...
-
C语言把结构成员作为参数传递-C语言基础教程实例源码|
C语言把结构成员作为参数传递 /* funds1.c -- passing structure members as arguments */ #include stdio.h #define FUNDLEN 50 struct funds { char bank [ FUNDLEN ]; double ba...
-
C实例计算中位数-C语言实例教程|
C实例 计算中位数 #include stdio.h void swap ( int * p , int * q ) { int t ; t =* p ; * p =* q ; * q = t ; } void sort ( int a [], int n ) { int i , j , temp ; for ( i = 0 ; i...
-
C语言指向结构的指针-C语言基础教程实例源码|
C语言指向结构的指针 /* friends.c -- uses pointer to a structure */ #include stdio.h #define LEN 20 struct names { char first [ LEN ]; char last [ LEN ]; }; struct guy { str...
-
C实例计算平均值-C语言实例教程|
C实例 计算平均值 #include stdio.h int main () { float mean ; int sum , i ; int n = 5 ; int a [] = { 2 , 6 , 7 , 4 , 9 }; sum = 0 ; for ( i = 0 ; i n ; i ++ ) { sum += a [ i ]...
-
C语言嵌套结构实例-C语言基础教程实例源码|
C语言嵌套结构实例 // friend.c -- example of a nested structure #include stdio.h #define LEN 20 const char * msgs [ 5 ] = { Thank you for the wonderful evening, , You certain...
-
C实例计算百分比-C语言实例教程|
C实例 计算百分比 #include stdio.h int main () { float percentage ; int total_marks = 1200 ; int scored = 1122 ; percentage = ( float ) scored / total_marks * 100.0 ; printf (...
-
C语言结构数组实例-C语言基础教程实例源码|
C语言结构数组实例 /* manybook.c -- multiple book inventory */ #include stdio.h #include string.h char * s_gets ( char * st , int n ); #define MAXTITL 40 #define MAXAUTL 40 #...
-
C实例斐波那契系列-C语言实例教程|
C实例 斐波那契系列 #include stdio.h int main () { int a , b , c , i , n ; n = 4 ; a = b = 1 ; printf ( %d %d , a , b ); for ( i = 1 ; i = n - 2 ; i ++ ) { c = a + b ; printf...
-
C语言打印图书目录实例-C语言基础教程实例源码|
C语言打印图书目录实例 //* book.c -- one-book inventory */ #include stdio.h #include string.h char * s_gets ( char * st , int n ); #define MAXTITL 41 /* maximum length of t...
-
C示例因子计划-C语言实例教程|
C示例因子计划 #include stdio.h int main () { int loop ; int factorial = 1 ; int number = 5 ; for ( loop = 1 ; loop = number ; loop ++ ) { factorial = factorial * loop ; } prin...