欢迎来到冰点文库! | 帮助中心 分享价值,成长自我!
冰点文库
全部分类
  • 临时分类>
  • IT计算机>
  • 经管营销>
  • 医药卫生>
  • 自然科学>
  • 农林牧渔>
  • 人文社科>
  • 工程科技>
  • PPT模板>
  • 求职职场>
  • 解决方案>
  • 总结汇报>
  • ImageVerifierCode 换一换
    首页 冰点文库 > 资源分类 > DOCX文档下载
    分享到微信 分享到微博 分享到QQ空间

    C语言简单编程题Word格式文档下载.docx

    • 资源ID:356680       资源大小:20.54KB        全文页数:32页
    • 资源格式: DOCX        下载积分:3金币
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录 QQ登录
    二维码
    微信扫一扫登录
    下载资源需要3金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP,免费下载
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    C语言简单编程题Word格式文档下载.docx

    1、#define M 10void insert(int a, int n);void choice(int a, int n);void BubbleSort(int a, int n);void print(int a,int n); void main() int aM, i;请输入%d个整数:, M); for(i = 0; i 0; j-) if(aj aj-1) temp = aj; aj = aj-1; aj-1 = temp; break;void choice(int a, int n) /选择排序 int i, j, temp = 0, t=0; n; t = i; for(

    2、j = i + 1; j aj) t = j; temp = ai; ai = at; at = temp;void BubbleSort(int a, int n) int i, j, temp; n - 1; for(j = 0;n - 1 -i ; if(aj aj+1) temp = aj; aj = aj+1; aj+1 = temp;void print(int a,int n) int i;输出排序后的整数:,ai);3. 已知head指向一个带头结点的单向链表,链表中每个结点包含数据域(data)和指针域(next)。 请编写函数实现如图所示链表逆置。要求: 不开辟任何额外的链

    3、表结点空间,实现链表的就地逆置考察: 对链表结构的基本操作malloc.hstdlib.hstring.h#define LEN sizeof(struct sth)struct sth char a20; struct sth *next;struct sth *creat(void);struct sth *exchange(struct sth *creat);void print(struct sth *head);void free1(struct sth *head);void main(void) struct sth *head;请输入链表: n head = creat();

    4、请输出链表: print(head); exchange(head);输出逆置的链表: free1(head);struct sth *creat(void) struct sth *head = NULL; struct sth *p1, *p2; char input10=0 / p1 = p2 = (struct sth*)malloc(LEN); if(p1 =(struct sth*)malloc(LEN)= NULL)内存不足,请稍后再试! head = p1; p2 = head;请输入相关信息: while(gets(input) != 0 & input0 != 0) if(

    5、p1 = (struct sth*)malloc(LEN)= NULL) p2 - next = p1; p2 = p1; p1 - next = NULL; strcpy(p1 - a, input);请输入数据(空行则退出链表的输入): return (head); struct sth *exchange(struct sth *head) struct sth *p1, *p2, *p3; p1=head-next; ; p2=p1- p3=p2- p2-next = p1; p1-next = NULL; p1 = p2; p2 = p3; while(p2!=NULL) p3 =

    6、p2 - next; / p2- head - return head;void print(struct sth *head) struct sth *p1; p1 = head- if(head!= NULL) while(p1 ! printf(%sn, p1-a); p1 = p1- void free1(struct sth *head) if(head! if(p1! p2 = p1- free(p1);功能描述:4.有两个链表a和b,设结点中包含学号和姓名。 从a链表中删去与b链表中相同学号的结点。#define LEN sizeof(struct student)struct

    7、student char num10; char name10; struct student *next;struct student*creat(void);void print(struct student *heada);void free1(struct student *heada);struct student*found(struct student *heada, struct student *headb);int main(void) struct student *head1, *head2;请输入链表a: head1 = creat(); print(head1);请

    8、输入链表b: head2 = creat(); print(head2); printf(输出删除后的链表a: found(head1, head2); free1(head1); free1(head2); return (0);struct student *creat(void) int n = 0, i; char num2 = struct student *head; struct student *p1, *p2; head = NULL; p1 = p2 = (struct student *)malloc(LEN);请分别输入学号和姓名:例:1204 王岩n%s %s,p1-

    9、num, p1-name); while(p1-num != NULL & strcmp(qnum) fflush(stdin); n = n + 1; if(n = 1) head = p1; p1 = (struct student *)malloc(LEN);struct student*found(struct student *heada, struct student *headb) struct student *p3, *p4; int flag; if(heada = NULL)end p1 = p2 = heada; p3 = p4 = headb; while(p1! f

    10、lag = 0; while(p3! if(strcmp(p1-num, p3-num) = 0) flag = 1; if( p1 = heada) heada = p1- p1 = heada;next = p1- p1 = p2- p3 = p3- if(flag = 0) p1 = p1- p3 = headb; print(heada);void print(struct student *heada) struct student *p1;%s, %snvoid free1(struct student *heada) struct student*p1, *p2; p2 = p1

    11、 = heada; while(p1 !5.请编写这样一个程序,要求反复输入您的年龄,然后显示该年龄已经过了多少秒?当数据溢出时或者输入非法时发出报警声,输入q则退出程序(注意对常数的定义,年按每年365天计算)。#define NUM_YEAR 365int main() int second, s, i, a;输入年龄:,& if(a=1) & (a68)a else if(a=q)out /return;将一个5*5的矩阵中最大的元素放在中心, 四个角分别放四个最小的元素 (顺序从左到右,从上到下顺序依次从小到大存放), 写一个函数实现之。 用main函数调用。void array(in

    12、t a55); int a55, i, j;输入25个数: 5; for(j = 0; scanf(aij);以矩阵的形式输出25个数: if(j + 1) % 5 = 0) printf( %d, aij); break; array(a);输出交换后的矩阵:void array(int a55) int i, j, min1, min2, min3, min4, max, temp, mini = 0, minj = 0; int min_1 = 0, min_2 = 0, min_3 = 0, min_4 = 1, min_5 = 0, min_6 = 1, min_7 = 0, min

    13、_8 = 1; max = a00; min1 = a00; if(min1 aij) min1 = aij; min_1 = i; min_2 = j; temp = a00; a00 = amin_1min_2; amin_1min_2 = temp; min2 = a01; if(min2 aij & (i != 0 | j ! min2 = aij; min_3 = i; min_4 = j; temp = a04; a04 = amin_3min_4; amin_3min_4 = temp; min3 = a01; if(min3 aij) &=0 | j != 0) &= 4) m

    14、in3 = aij; min_5 = i; min_6 = j; temp=a40; a40=amin_5min_6; amin_5min_6=temp; min4 = a01; if(min4 = 4) &= 4 | j ! min4 = aij; min_7 = i; min_8 = j; temp = a44; a44 = amin_7min_8; amin_7min_8 = temp; if(max max = aij; mini = i; minj = j; temp = a22; a22 = aminiminj; aminiminj = temp;功能描述 9.(1)编写一段程序,

    15、实现统计一个或多个文件的行数、字数和字符数,程序中包括错误检查, 以确定参数数目是否正确和是否能打开文件。 如果不能打开文件,程序要报告这一情况然后继续处理下一个文件。要求说明: a)一个行由一个换行符限定,一个字由空格分隔(包括空白符、制表符和换行符), b)字符是指文件中的所有字符。要求程序设置3个任选的参数,让用户指定他所要的统计或操作。 它们是: 1 统计文件行数 w 统计文件字数 c 统计文件字符数 若用户未指定任选的参数,则默认是lwc都有。 c) 运行本程序时的参数按以下格式给出: -l -w -c 文件1 文件2 . 文件n 其中,参数l、w、c的出现与否和出现顺序任意,或任意

    16、组合在一起出现, 如:-lwc,-cwl,-lw,-wl,-lc,-cl,cw等。程序依次打开每个文件, 然后报告每个文件中相应的统计信息。文件名和统计信息一起报告。 (1)程序的命令行参数提供 (2)文件的基本操作 (3)错误检测和程序运行控制。 (2)在(1)的基础上可以添加每个文件中统计特定字符(串)和替换功能。 a)程序参数运行如下: f 查找文件中的某个字符(串) r 替换文件中的某个字符(串)为其他 b)运行本程序时的参数按以下格式给出: -f 字符(串) 文件1 文件2 文件n 程序依次打开每个文件,然后报告每个文件中该字符(串)出现的次数。 文件名和字符(串)本身也与计数值一起报告。 -r 字符(串)1 字符(串)2 文件1 文件2 文件n 程序依次打开每个文件,然后依次将每个文件中字符(串)1全部替换为字符(串)2int file1(char *p);int file2(char *p);int file3(char *p);int main(int argc, char *argv) int count, i, lflag = 0, wflag = 0, cflag = 0; char *t;The command line has %d


    注意事项

    本文(C语言简单编程题Word格式文档下载.docx)为本站会员主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    copyright@ 2008-2023 冰点文库 网站版权所有

    经营许可证编号:鄂ICP备19020893号-2


    收起
    展开