注意: 指针函数的返回值一定要是地址,并且返回值的类型要与函数类型一致。 #include "stdio.h"#include "conio.h"int *min(int,int);int *minp(int *,int *);void main(){ int a,b,*p; clrscr(); scanf("%d,%d",&a,&b); p=min(a,b); prin... Read More
posted @ 2007-01-18 10:32 齐心 Views(737) Comments(0) Diggs(0) Edit
判断的依据是 空格' '字符 #include "stdio.h"#include "conio.h"#include "string.h"int count_words(char str[]);void main(){ int n; char s[80]; clrscr(); printf("Input a string:"); gets(s); n=count_words(s); ... Read More
posted @ 2007-01-17 09:56 齐心 Views(1348) Comments(0) Diggs(0) Edit
从键盘输入一个正整数,判断其是否为回文数。所谓回文数是顺读和反读都一样的数,如12321,23455432都是回文数。 #include "Stdio.h"#include "Conio.h"int main(void){ int i,k; long n,m; int digit[10]; clrscr(); puts("Please input a long number:"); s... Read More
posted @ 2007-01-17 09:33 齐心 Views(4267) Comments(0) Diggs(0) Edit
#include #include #define N 10void yanghui(int a[][N],int n);void main(){ int i,j,n,b[N][N]; printf("Enter n:"); scanf("%d",&n); yanghui(b,n); for(i=0;i<n;i++) { for(j=0;j<=i;j++) pr... Read More
posted @ 2007-01-17 08:53 齐心 Views(890) Comments(0) Diggs(0) Edit
折半查找法:针对有序数组 #include #include #define M 10void main(){ static int a[M]={-12,0,6,16,23,56,80,100,110,115}; int n,low,mid,high,found; low=0; high=M-1; found=0; printf("Input a number to be search... Read More
posted @ 2007-01-16 11:06 齐心 Views(528) Comments(0) Diggs(0) Edit