C语言
-
C语言条件运算符-C语言基础教程实例源码|
C语言条件运算符 /* paint.c -- uses conditional operator */ #include stdio.h #define COVERAGE 350 // square feet per paint can int main ( void ) { int sq_feet ; int cans ; pri...
-
C语言统计程序实例-C语言基础教程实例源码|
C语言统计程序实例 // wordcnt.c -- counts characters, words, lines #include stdio.h #include ctype.h // for isspace() #include stdbool.h // for bool, true, false #define STOP...
-
C语言逻辑运算符实例-C语言基础教程实例源码|
C语言逻辑运算符实例 // chcount.c -- use the logical AND operator #include stdio.h #define PERIOD . int main ( void ) { char ch ; int charcount = 0 ; while (( ch = getchar (...
-
C语言多重嵌套if-C语言基础教程实例源码|
C语言多重嵌套if // divisors.c -- nested ifs display divisors of a number #include stdio.h #include stdbool.h int main ( void ) { unsigned long num ; // number to be checked un...
-
计算机编程函数-C语言实例教程|
计算机编程 函数 #include stdio.h int main () { int set1 [ 5 ] = { 10 , 20 , 30 , 40 , 50 }; int set2 [ 5 ] = { 101 , 201 , 301 , 401 , 501 }; int i , max ; /* Process first s...
-
C语言elseif实例-C语言基础教程实例源码|
C语言else if 实例 // electric.c -- calculates electric bill #include stdio.h #define RATE1 0.13230 // rate for first 360 kwh #define RATE2 0.15040 // rate for next 108 kwh #defi...
-
计算机编程使用C字符串-C语言实例教程|
计算机编程使用C字符串 #include stdio.h int main () { char ch [ 5 ] = Hello ; int i = 0 ; /* Print as a complete string */ printf ( String = %s , ch ); /* Print character b...
-
计算机编程使用%c打印字符值-C语言实例教程|
计算机编程 使用%c打印字符值 #include stdio.h int main () { char ch [ 5 ] = { H , e , l , l , o }; int i = 0 ; while ( i 5 ) { printf ( ch[%d] = %c , i , ch [ i ] ); i = ...
-
计算机编程字符串-C语言实例教程|
计算机编程 字符串 #include stdio.h int main () { int number [ 5 ] = { 10 , 20 , 30 , 40 , 50 }; int i = 0 ; while ( i 5 ) { printf ( number[%d] = %d , i , number [ i ] ); i ...
-
计算机编程访问数组元素-C语言实例教程|
计算机编程 访问数组元素 #include stdio.h int main () { int number [ 10 ]; /* number is an array of 10 integers */ int i = 0 ; /* Initialize elements of array n to 0 */ wh...
-
计算机编程数组-C语言实例教程|
计算机编程 数组 #include stdio.h int main () { int number1 ; int number2 ; int number3 ; int number4 ; int number5 ; number1 = 10 ; number2 = 20 ; number3 = 30 ; number4 = 40...
-
计算机编程打印语句中的转义序列-C语言实例教程|
计算机编程打印语句中的转义序列 #include stdio.h int main () { char ch1 ; char ch2 ; char ch3 ; char ch4 ; ch1 = ; ch2 = ; printf ( Test for tabspace %c and a newline ...
-
计算机编程数字运算-C语言实例教程|
计算机编程数字运算 #include stdio.h #include math.h int main () { short s ; int i ; long l ; float f ; double d ; printf ( sin(s): %f , sin ( 10 )); printf ( abs(i): %f , a...
-
C语言ctype函数实例-C语言基础教程实例源码|
C语言ctype函数实例 // cypher2.c -- alters input, preserving non-letters #include stdio.h #include ctype.h // for isalpha() int main ( void ) { char ch ; while (( ch = getchar ...
-
计算机编程数字的类型-C语言实例教程|
计算机编程 数字的类型 #include stdio.h int main () { short s ; int i ; long l ; float f ; double d ; s = 10 ; i = 1000 ; l = 1000000 ; f = 230.47 ; d = 30949.374 ; printf ...
-
C语言if语句getcharputchar-C语言基础教程实例源码|
02 C语言if语句 getchar putchar // cypher1.c -- alters input, preserving spaces #include stdio.h #define SPACE // thats quote-space-quote int main ( void ) { char ch ; ch = getch...
-
计算机编程Continue语句-C语言实例教程|
计算机编程 Continue 语句 #include stdio.h int main () { int i = 0 ; do { if ( i == 3 ) { i = i + 1 ; continue ; } printf ( Hello, World! ); i = i + 1 ; } while ( i 5 ); }...
-
C语言if语句实例-C语言基础教程实例源码|
C语言if语句实例 // colddays.c -- finds percentage of days below freezing #include stdio.h int main ( void ) { const int FREEZING = 0 ; float temperature ; int cold_days = 0 ; ...
-
C语言for循环实例-C语言基础教程实例源码|
C语言for循环实例 /* for_13s.c */ #include stdio.h int main ( void ) { int n ; // count by 13s from 2 for ( n = 2 ; n 60 ; n = n + 13 ) printf ( %d , n ); return 0 ; }...
-
C语言循环实例-C语言基础教程实例源码|
C语言循环实例 // power.c -- raises numbers to integer powers #include stdio.h double power ( double n , int p ); // ANSI prototype int main ( void ) { double x , xpow ; int ex...