|
|
|
|
@ -1,4 +1,31 @@
|
|
|
|
|
# include
|
|
|
|
|
//一统计个数
|
|
|
|
|
#include<stdio.h>
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
char ch[10];
|
|
|
|
|
gets(ch);
|
|
|
|
|
int big=0, small=0, num=0, blank=0, other=0;
|
|
|
|
|
int i;
|
|
|
|
|
for(i = 0; i < 10; i ++)
|
|
|
|
|
{
|
|
|
|
|
if(ch[i] >= 'a' && ch[i] <= 'z')
|
|
|
|
|
small ++;
|
|
|
|
|
else if(ch[i] >='A' && ch[i] <= 'Z')
|
|
|
|
|
big ++;
|
|
|
|
|
else if(ch[i] == ' ')
|
|
|
|
|
blank ++;
|
|
|
|
|
else if(ch[i] >= '0' && ch[i] <= '9')
|
|
|
|
|
num ++;
|
|
|
|
|
else
|
|
|
|
|
other ++;
|
|
|
|
|
}
|
|
|
|
|
printf("大写字母:%d\n",big);
|
|
|
|
|
printf("小写字母:%d\n",small);
|
|
|
|
|
printf("数字%d\n",num);
|
|
|
|
|
printf("空格%d\n",blank);
|
|
|
|
|
printf("其他字符:%d\n",other);
|
|
|
|
|
}
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
//二、判断素数
|
|
|
|
|
int main() {
|
|
|
|
|
@ -21,3 +48,31 @@ int main() {
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
//四输出菱形图形
|
|
|
|
|
#include<stdio.h>
|
|
|
|
|
#include<math.h>
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
int n, i, j, k, m;
|
|
|
|
|
printf("请输入一个整数:\n");
|
|
|
|
|
scanf("%d", &n);
|
|
|
|
|
printf("图形为");
|
|
|
|
|
m = 2 * n - 1;
|
|
|
|
|
for(i = 1; i <= n; i ++)
|
|
|
|
|
{
|
|
|
|
|
for(j = 1; j <= abs(i - n); j ++)
|
|
|
|
|
printf(" ");
|
|
|
|
|
for(k = j - 1; k < m - abs(i - n); k ++)
|
|
|
|
|
printf("*");
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
for(i = n - 1; i >= 1; i --)
|
|
|
|
|
{
|
|
|
|
|
for(j = 1; j <= abs(i - n); j ++)
|
|
|
|
|
printf(" ");
|
|
|
|
|
for(k = j - 1; k < m - abs(i - n); k ++)
|
|
|
|
|
printf("*");
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|