摘要: #include <stdio.h> int main() { unsigned int a=6; int b=-20; (a+b>6)?puts("sum>6"):puts("sum<=6"); }//运行结果: sum>6 #include <stdio.h> int main() { int 阅读全文
posted @ 2020-09-23 14:45 yanglike111 阅读(259) 评论(0) 推荐(0)
摘要: #include <stdio.h> int main() { char s1[]="I love China"; char s2[]="I love"; char *str1=s1,*str2=s2; int answer=0; while(!(answer=*str1-*str2)&& *str 阅读全文
posted @ 2020-09-23 14:25 yanglike111 阅读(161) 评论(0) 推荐(0)
摘要: #include <stdio.h> int main() { int a[]={89,88,76,70,68,58}; int x=70,mid,pos=-1,find=0,low=0,high=5; while(!find && low<=high){ mid=(low+high)/2; if( 阅读全文
posted @ 2020-09-23 14:13 yanglike111 阅读(186) 评论(0) 推荐(0)
摘要: //下面程序的功能是把一个文件的内容拷贝到另一个文件,如果拷贝成功,则提示 //"File Copy Success!"。 #include <stdio.h> int main() { FILE *fpSrc;//源文件 FILE *fpDes;//目标文件 int ch; if((fpSrc=f 阅读全文
posted @ 2020-09-23 10:54 yanglike111 阅读(276) 评论(0) 推荐(0)
摘要: //下列给定程序中函数f的功能是:根据整型形参(x,t),计算公式前几项的值。 //例如,若x=2,n=10,则输出为:sin(2)=0.909347 #include <stdio.h> double f(int x,int n) { int i,j; long double t,xt; int 阅读全文
posted @ 2020-09-23 10:40 yanglike111 阅读(155) 评论(0) 推荐(0)
摘要: /*下面程序的功能是:调用Sort()排序函数,通过传递相应参数用选择法按升序(或降序) 对数组中的数进行排序。假设数组中存储数据为{88,67,78,56,90},若升序排序则结果为: {56,67,78,88,90},若降序排序则结果为 {90,88,78,67,56}。 */ #include 阅读全文
posted @ 2020-09-23 09:06 yanglike111 阅读(202) 评论(0) 推荐(0)