摘要:
1 #include 2 #include 3 int main(){ 4 char s[100]; 5 gets(s); 6 printf("原字符串:%s\n",s); 7 printf("变大写字符串%s\n",strupr(s)); 8 printf("变小写字符串%s\n",strlwr(s)); 9 return ... 阅读全文
摘要:
1 #include 2 #include 3 int main(){ 4 char s1[100]; 5 gets(s1); 6 puts(s1); 7 printf("字符串长度:%d\n",strlen(s1)); 8 return 0; 9 } 阅读全文
摘要:
1 #include <stdio.h> 2 int main(){ 3 char s1[1]; 4 gets(s1); 5 puts(s1); 6 printf("%d\n",sizeof(s1)); 7 printf("%c\n",s1[1]); 8 return 0; 9 } 阅读全文
摘要:
//字符串数组 #include int main(){ char s1[]={"I am a boy"}; char s2[]={"I am a boy\0 and a student"};//遇到\0字符串结束 printf("%s\n",s1); printf("%s\n",s2); return 0; } 阅读全文
摘要:
1 //判断一个数字是否是素数(素数只能被1和它自己整除) 2 #include 3 #include 4 int main(){ 5 int num; 6 int flag=0; 7 printf("输入一个数字:\n"); 8 scanf("%d",&num); 9 for(int i=2;i<=sqrt(num);i++){ 1... 阅读全文
摘要:
//利用格里高利公式π/4=1-1/3+1/5-1/7+...,求圆周率,要求最后一行绝对值小于10e-6 #include #include int main(){ double sum=1,k=1,m=1,t=0; do{ m=-m; k+=2; t=m/k; sum=sum+t; }while(fabs(t)>=0.000001); printf("%lf\n"... 阅读全文
摘要:
1 //输出Fibonacci数列1,1,2,3,5,8,13,21,...的前40项 2 //经过观察,我们可以得出结论后一项是前两项之和 3 #include <stdio.h> 4 int main(){ 5 int a,b,c; 6 a=1; 7 b=1; 8 c=a+b; 9 int su 阅读全文
摘要:
//求s=10!,即求10的阶乘 start #include int main(){ int s=1; for(int i=1;i<=10;i++){ s=s*i; } printf("%d",s); return 0; } 阅读全文
摘要:
#include int main(){ char c1,c2,c3; c1=getchar(); c2=getchar(); c3=getchar(); putchar(c1); putchar(c2); putchar(c3); return 0; } 阅读全文
摘要:
以下是主要程序的代码 以下是resource.h的代码 以下是resource.rc的代码 以下是程序运行的效果 阅读全文