#include
<stdio.h>
#include
<process.h>
void
main()
{
FILE
*pFile
=
fopen("a.txt",
"w")
char
str[]
=
"你想要输入的字符串"
fwrite(str,1,
sizeof(str)/sizeof(str[0]),
pFile)
fclose(pFile)
system("notepad
a.txt")
}
#include<stdio.h>#include<stdlib.h>
main()
{
FILE *fp
int a,j,l
int flag
int s[a-1]
char i[a-1]
char k[a-1]
float pct[a-1]
char c
a=0
if ((fp=fopen("c:\\1.txt","r"))==NULL)
{printf ("can`t open")
exit(0)}
for (j=0!feof(fp)j++)
{
a++
c=fgetc(fp)
i[j]=c
k[j]= c
printf ("%c",c)
s[j]=0
pct[j]=0.0
}
printf ("\n共有%d个字符",a-1)
for (l=0l<(a-1)l++)
{
for (j=0j<(a-1)j++)
{ if (k[l]==i[j])
{ s[l]++}
}
}
printf("\nchar number percent\n")
for (l=0l<(a-1)l++)
{ flag=1
for (j=lj<=(a-1)j++)
{if (i[j]==i[l]&&l!=j)
{ flag=0
continue
}
}
if (flag!=0)
{
printf("%2c %6d \t\n",i[l],s[l])
}
}
}
C:\>"C:\Documents and Settings\Administrator\桌面\未命名1.exe"
abcdlllleaocmezl�
共有16个字符
char number percent
b 1
d 1
a 2
o 1
c 2
m 1
e 2
z 1
l 5
只实现了一部分,希望哪位朋友可以帮你完善
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)