C语言
-
C语言地址运算符-C语言基础教程实例源码|
C语言地址运算符 /* loccheck.c -- checks to see where variables are stored */ #include stdio.h void mikado ( int ); /* declare function */ int main ( void ) { int pooh = 2 , b...
-
C实例不使用第三个变量交换-C语言实例教程|
C实例 不使用第三个变量交换 #include stdio.h int main () { int a , b ; a = 11 ; b = 99 ; printf ( Values before swapping - a = %d, b = %d , a , b ); a = a + b ; // ( 11 +...
-
C语言函数递归实例-C语言基础教程实例源码|
C语言函数递归实例 /* binary.c -- prints integer in binary form */ #include stdio.h void to_binary ( unsigned long n ); int main ( void ) { unsigned long number ; printf ( En...
-
C实例使用第三个变量交换变量-C语言实例教程|
C实例 使用第三个变量交换变量 #include stdio.h int main () { int a , b , temp ; a = 11 ; b = 99 ; printf ( Values before swapping - a = %d, b = %d , a , b ); temp = a ; ...
-
C语言递归实例-C语言基础教程实例源码|
C语言递归实例 // factor.c -- uses loops and recursion to calculate factorials #include stdio.h long fact ( int n ); long rfact ( int n ); int main ( void ) { int num ; printf ...
-
C闰年计划示例-C语言实例教程|
C闰年计划示例 #include stdio.h int main () { int year ; year = 2016 ; if ((( year % 4 == 0 ) ( year % 100 != 0 )) || ( year % 400 == 0 )) printf ( %d is a leap year , year ); ...
-
C语言函数原型实例-C语言基础教程实例源码|
C语言函数原型实例 /* proto.c -- uses a function prototype */ #include stdio.h int imax ( int , int ); /* prototype */ int main ( void ) { printf ( The maximum of %d and %d i...
-
C实例找正数或负数-C语言实例教程|
C实例 找正数或负数 #include stdio.h int main () { int number = - 2 ; if ( number = 0 ) printf ( %d is positive , number ); else printf ( %d is negative , number ); return 0 ...
-
C语言函数返回值-C语言基础教程实例源码|
C语言函数返回值 /* lesser.c -- finds the lesser of two evils */ #include stdio.h int imin ( int , int ); int main ( void ) { int evil1 , evil2 ; printf ( Enter a pair of inte...
-
C实例找奇数或偶数程序-C语言实例教程|
C实例 找奇数或偶数程序 #include stdio.h int main () { int even = 24 ; int odd = 31 ; if ( even % 2 == 0 ) printf ( %d is even , even ); if ( odd % 2 != 0 ) printf ( %d is ...
-
C实例比较三个整数-C语言实例教程|
C实例 比较三个整数 #include stdio.h int main () { int a , b , c ; a = 11 ; b = 22 ; c = 33 ; if ( a b a c ) printf ( %d is the largest. , a ); else if ( b a b c ) printf ( %...
-
C实例比较两个整数-C语言实例教程|
C实例 比较两个整数 #include stdio.h int main () { int a , b ; a = 11 ; b = 99 ; // to take values from user input uncomment the below lines // printf(Enter value for A :); /...
-
C实例除法操作-C语言实例教程|
C实例 除法操作 #include stdio.h int main () { int op1 , op2 , div ; // variable declaration op1 = 6 ; // variable definition op2 = 3 ; div = 6 / 3 ; // division operation prin...
-
C实例乘法操作-C语言实例教程|
C实例 乘法操作 #include stdio.h int main () { int op1 , op2 , mul ; // variable declaration op1 = 5 ; // variable definition op2 = 3 ; mul = op1 * op2 ; // multiplication oper...
-
C实例减法操作-C语言实例教程|
C实例 减法操作 #include stdio.h int main () { int op1 , op2 , sub ; // variable declaration op1 = 5 ; // variable definition op2 = 3 ; sub = op1 - op2 ; // subtraction operati...
-
C语言函数参数实例-C语言基础教程实例源码|
C语言函数参数实例 /* lethead2.c */ #include stdio.h #include string.h /* for strlen() */ #define NAME GIGATHINK, INC. #define ADDRESS 101 Megabuck Plaza #define PLACE Megapo...
-
C语言创建和使用函数实例-C语言基础教程实例源码|
C语言创建和使用函数实例 /* lethead1.c */ #include stdio.h #define NAME GIGATHINK, INC. #define ADDRESS 101 Megabuck Plaza #define PLACE Megapolis, CA 94904 #define WIDTH ...
-
C语言猜数游戏-C语言基础教程实例源码|
C语言猜数游戏 /* newguess.c -- an inefficient but improved number-guesser */ #include stdio.h int main ( void ) { int guess = 1 ; char response ; printf ( Pick an integer from...
-
C语言菜单程序-C语言基础教程实例源码|
C语言菜单程序 /* menuette.c -- menu techniques */ #include stdio.h char get_choice ( void ); char get_first ( void ); int get_int ( void ); void count ( void ); int main ( voi...
-
C语言输入验证-C语言基础教程实例源码|
C语言输入验证 // checking.c -- validating input #include stdio.h #include stdbool.h // validate that input is an integer long get_long ( void ); // validate that range limits ...