930_18

2018-16

//16和18题忘记当时做的对不对了,可以自己再康康。

//真题2018-16  编写程序:输入正整数n(1~10000),
//再输入n个正整数,找出这n个数中出现次数最多的数字,
//统计并输出其出现次数。
//例如1234,2345,3456中出现次数最多的数字是3和4,出现次数均为3次。 

#include<stdio.h>
#include<stdlib.h>
#define N 10000
int main()
{
	int n,i,j,count=0;
	int n0,n1,n2,n3,n4,n5,n6,n7,n8,n9;
	n0=n1=n2=n3=n4=n5=n6=n7=n8=n9=0;
	printf("请输入一个数字:\n",n);
	scanf("%d",&n);
	int *c = (int*)malloc(n*sizeof(int));
	
	for(i=0; i<n; i++){
		scanf("%d",c+i);
	}
	
	for(i=0; i<n; i++){	//i表示每组数据 
		for(j=0; c[j]!='\0'; j++){	//j表示? 
			if(c[i]==c[j])
				count++;
		}
	}
	
	return 0;
} 

2018-17

//真题2018-17
//输入字符串s和字符ch,在字符串s中找到所有的ch字符后删除,得到新的字符串并输出。
//要求通过编写用函数void delchar(char *s,char ch),实现将字符串s中的ch字符找到后删除的操作

void delchar(char *s, char ch){
	int i=0,j;
	while(s[i]!='\0'){
		if(s[i] == ch){
			for(j=i;s[j]!='\0';j++)
				s[j] = s[j+1];
			i--;//这里为啥要加一个i--呢,因为我发现如果是两个要删除的字符是连在一起的话,不加这一步操作就会漏删
		}	
		i++;
	}
	printf("%s",s);
} 

2018-18

//真题 2018-18
//要求:建立一个联系人联系簿,包含姓名、出生日期、电话三项
//出生日期包含年月日三项,要求用内嵌结构体实现。
//输入n个(小于8)联系人的信息存入联系簿,并按年龄大小由大到小输出

#include<stdio.h>
#define N 3
int main()
{
	int i,j,k;
	struct Data{
			int year[N];
			int month[N];
			int day[N];
	}birth;
	
	struct Con{
		char name[20];
		char num[20];
		struct Data birth;
	}p[N];
	struct Con temp;
	
	for(i=0;i<N;i++)
		scanf("%s %d %d %d %s", p[i].name, &p[i].birth.year[i], &p[i].birth.month[i], &p[i].birth.day[i], p[i].num);
	for(i=0; i<N; i++){
		k = i;
		for(j=i; j<N; j++)
			if(p[j].birth.year[j] > p[k].birth.year[k])
				k = j;
		temp = p[i];
		p[i] = p[k];
		p[k] = temp;	
	}	
	
	for(i=0; i<N; i++){
		k = i;
		for(j=i; j<N; j++)
			if((p[j].birth.year[j] <= p[k].birth.year[k]) && (p[j].birth.month[j] < p[k].birth.month[k]))
				k = j;
		temp = p[i];
		p[i] = p[k];
		p[k] = temp;	
	}
	
	for(i=0; i<N; i++){
		k = i;
		for(j=i; j<N; j++)
			if((p[j].birth.year[j] <= p[k].birth.year[k]) && (p[j].birth.month[j] <= p[k].birth.month[k]) && (p[j].birth.day[j] <= p[k].birth.day[k]))
				k = j;
		temp = p[i];
		p[i] = p[k];
		p[k] = temp;	
	}
	
	for(i=0; i<N; i++)
		printf("%s %d %d %d %s", p[i].name, p[i].birth.year[i], p[i].birth.month[i], p[i].birth.day[i], p[i].num);

	return 0;
} 

/*
测试用例
zhang 2000 1 6
li 1997 3 4
*/

2018-25

//真题 2018-25 
//编写函数,统计链表结点data域中出现的X结点个数
int find(LNode *h, int x){
	LNode *p;
	int count;
	p = h->next;
	while(p!=NULL){
		if(p->data == x)
			count++; 
		p = p->next;
	}
	return count;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
安卓APP访问CAN有如下报错05-16 18:09:54.015 8022 8022 D can_test: nCanFd = 67 05-16 18:09:54.015 8022 8022 D can_test: Send can_id 05-16 18:09:54.013 8022 8022 I com.bin.cantest: type=1400 audit(0.0:444): avc: denied { ioctl } for path="socket:[114169]" dev="sockfs" ino=114169 ioctlcmd=0x8933 scontext=u:r:system_app:s0 tcontext=u:r:system_app:s0 tclass=can_socket permissive=1 05-16 18:09:54.015 8022 8022 D can_test: Send Error frame[0] 05-16 18:09:54.013 8022 8022 I com.bin.cantest: type=1400 audit(0.0:445): avc: denied { bind } for scontext=u:r:system_app:s0 tcontext=u:r:system_app:s0 tclass=can_socket permissive=1 05-16 18:09:54.013 8022 8022 I com.bin.cantest: type=1400 audit(0.0:446): avc: denied { write } for path="socket:[114169]" dev="sockfs" ino=114169 scontext=u:r:system_app:s0 tcontext=u:r:system_app:s0 tclass=can_socket permissive=1 05-16 18:09:54.020 0 0 W audit : audit_lost=15 audit_rate_limit=5 audit_backlog_limit=64 05-16 18:09:54.020 0 0 E audit : rate limit exceeded 05-16 18:09:54.060 305 388 W APM::AudioPolicyEngine: getDevicesForStrategy() unknown strategy: -1 05-16 18:09:54.060 459 477 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4 05-16 18:09:54.150 459 1215 E TaskPersister: File error accessing recents directory (directory doesn't exist?). 05-16 18:09:56.930 274 401 D AudioHardwareTiny: do_out_standby,out = 0xea043b70,device = 0x2 05-16 18:09:56.932 274 401 D alsa_route: route_set_controls() set route 24 05-16 18:09:56.941 274 401 D AudioHardwareTiny: close device 05-16 18:09:56.943 459 477 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4 05-16 18:10:00.010 620 620 D KeyguardClockSwitch: Updating clock:
最新发布
06-13

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值