ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

二级29套

2021-08-25 10:00:41  阅读:139  来源: 互联网

标签:二级 int void 29 char fun found include


blank
#include <stdio.h>
#define N 100
void fun( int *a , int n )
{ int i, t;
for( i=0; i<n; i++ )
/found/
a[i]=0;
i=0;
/found/
t=1;
while( i<n )
{ a[i]= 1;
t++;
/found/
i=i+t;
}
}
void main()
{ int a[N], i, n=30;
fun( a, n);
for(i=0; i<n; i++)
if( a[i]==1 ) printf(“不安全的洞号是 : %d\n”,i );
}
modi
#include<stdio.h>
#include <stdio.h>
#include <string.h>
void fun(char a[])
{ int b[26], i, n,max;
for (i=0; i<26; i++)
/found/
b[i] = 0;
n= strlen(a);
for (i=0; i<n; i++)
if (a[i] >=‘a’ && a[i]<=‘z’)
/found/
b[a[i] - ‘a’]++;
else if (a[i] >=‘A’ && a[i]<=‘Z’)
b[a[i] -‘A’]++;
max = 0;
for (i=1; i<26; i++)
/found/
if (b[max] < b[i])
max=i;
printf(“出现次数最多的字符是 : %c\n”, max + ‘a’);
}
void main( )
{ char a[200];
printf(“请输入一个待统计的字符串 : “); scanf(”%s”, a);
fun(a);
}
prog
#include <stdio.h>
#include <string.h>
void NONO();
long fun( char s )
{
int i,sum=0,len;
len=strlen(s);
for(i=0;i<len;i++)
{
sum=sum
10+*s-48;
s++;

}
return sum;

}
void main()
{ char s[10]; long r;
printf(“请输入一个长度不超过9个字符的数字字符串 : “); gets(s);
r = fun( s );
printf(” r = %ld\n” , r );
NONO();
}

void NONO()
{/* 本函数用于打开文件,输入数据,调用函数,输出数据,关闭文件。 */
FILE *fp, *wf ;
int i; long r;
char s[10], *p;

fp = fopen(“in.dat”,“r”) ;
wf = fopen(“out.dat”,“w”) ;
for(i = 0 ; i < 10 ; i++) {
fgets(s, 10, fp);
p = strchr(s, ‘\n’);
if § *p = 0;
r = fun(s);
fprintf(wf, “%ld\n”, r);
}
fclose(fp) ;
fclose(wf) ;
}

标签:二级,int,void,29,char,fun,found,include
来源: https://blog.csdn.net/qq_54603387/article/details/119904492

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有