#include
"stdio.h"
#define
N
100
int
main()
{
char
s[N]
printf("Input
a
string:\n")
scanf("%s",s)
int
i,up[26]={0},down[26]={0}
for(i=0i<N
&&
s[i]!=0i++)
{
if(s[i]>='A'蔽亮
&&
s[i]<='Z')
//
大写字母
up[
s[i]-'迹迅A'
]++
else
if(s[i]>='a'
&&
s[i]<='z')
//小写字母
down[
s[i]-'a'
]++
else
{
//
其它
出错
printf("What
you
input
is
not
a
valid
string,error-->
%c\n",s[i])
return
0
}
}
printf("The
result
is
as
follows:\n")
for(i=0i<26i++)
{
if(up[i]!=0)
printf("%c----%d\n",i+'A',up[i])
if(down[i]!=0)
printf("%c----%d\n",i+'a',down[i])
}
return
0
}
#include <stdio.h>#include <stdlib.h>
void main()
{
int r,p
char buf
printf("请输入概率:带隐基(举例:概率10%,输10)\n")
scanf("%d",&p)
scanf("%c",&buf)
while(1)
{
r=rand()%10*10/p
if(r==0)
{
printf("恭喜中奖!")
}
else
{
printf("不中奖!")
}
printf("\蠢谨n")
printf("按回车键继续!携拍\n")
scanf("%c",&buf)
if(buf!='\n')
break
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)