博客
关于我
【NEFU C语言阶段一】2021年计算机1班阶段考试复习 参考代码
阅读量:523 次
发布时间:2019-03-07

本文共 1910 字,大约阅读时间需要 6 分钟。

【NEFU C语言阶段一】2021年计算机1班阶段考试复习

看到有些人刷OJ上的题目顺便写了一下,各位可以庆幸一下不是在OJ上考C语言hh

应该是cy老师带的班,密码tuhao
在这里插入图片描述

A 字符串问题

字符替换,不过OJ那个样例数据有问题!

2 I i ThIs Is a C Program T t Now,I am Testing!
This is a C program//这里的p不应该小写的!Now,I am testing!
#include
#include
#include
#include
int main(){ int n; while(~scanf("%d ",&n)) { char a,b; char s[105]; while(n--) { scanf("%c %c ",&a,&b); gets(s); for(int i=0;s[i];i++) if(s[i]==a)s[i]=b; printf("%s",s); if(n)puts(""); } } return 0;}

B 数组元素查找

指针查找数组

#include
#include
#include
#include
#include
int a[105];int main(){ int n,x; while(~scanf("%d%d",&n,&x)) { int *p=a; for(int i=0;i

C 星级穿越

素数判断+二维数组遍历

#include
#include
#include
#include
#include
int a[105][105];bool is_prime(int x){ if(x<2)return 0; for(int i=2;i<=x/i;i++) if(x%i==0)return 0; return 1;}int main(){ int n,m; while(~scanf("%d%d",&n,&m)) { int cnt=0; for(int i=0;i

D 求取最高成绩及学号

函数参数为数组地址和变量地址

#include
#include
#include
#include
#include
int solve(double * sc,int n,double* ave){ *ave=0; int cnt=0; for(int i=0;i
*ave)cnt++; return cnt;}int main(){ int n; double sc[25]; double ave=0.0; while(~scanf("%d",&n)) { for(int i=0;i
ave) { tmp++; if(tmp

E 数据标准化

一维数组简单计算,读懂题目即可。

#include
#include
#include
#include
#include
double sc1[105],sc2[105];double fun(double x,double minx,double maxx){ return (x-minx)/(maxx-minx)*100;}int main(){ int n; while(~scanf("%d",&n)) { for(int i=0;i
max1)max1=sc1[i]; if(sc2[i]
max2)max2=sc2[i]; } printf("%.2lf",fun(sc1[0],min1,max1)+fun(sc2[0],min2,max2)); for(int i=1;i

转载地址:http://hqucz.baihongyu.com/

你可能感兴趣的文章
mysql 常用
查看>>
MySQL 常用列类型
查看>>
mysql 常用命令
查看>>
Mysql 常见ALTER TABLE操作
查看>>
MySQL 常见的 9 种优化方法
查看>>
MySQL 常见的开放性问题
查看>>
Mysql 常见错误
查看>>
mysql 常见问题
查看>>
MYSQL 幻读(Phantom Problem)不可重复读
查看>>
mysql 往字段后面加字符串
查看>>
mysql 快照读 幻读_innodb当前读 与 快照读 and rr级别是否真正避免了幻读
查看>>
MySQL 快速创建千万级测试数据
查看>>
mysql 快速自增假数据, 新增假数据,mysql自增假数据
查看>>
MySql 手动执行主从备份
查看>>
Mysql 批量修改四种方式效率对比(一)
查看>>
mysql 批量插入
查看>>
Mysql 报错 Field 'id' doesn't have a default value
查看>>
MySQL 报错:Duplicate entry 'xxx' for key 'UNIQ_XXXX'
查看>>
Mysql 拼接多个字段作为查询条件查询方法
查看>>
mysql 排序id_mysql如何按特定id排序
查看>>