- 博客(15)
- 收藏
- 关注
原创 字符串大小写转换
题目:实现一个函数void lowers(char *s,char *ls),把字符串s中的大写字母转为小写字母,存放在字符串ls中。
2022-12-15 13:03:48
288
原创 C程序设计(谭浩强)课后习题第5章
题目:求Sn=a+aa+aaa+...+aa...a之值,其中a是一个数字,n由键盘输入,例如:2+22+222+2222+22222(此时n=5)
2022-12-14 21:03:38
127
原创 输入某年某月某日,判断这一天是这一年的第几天,并输出今年还剩多少天
例如:输入2020,12,25,则输出12月25日为2020年的第360天,今年还剩下6天。题目:输入某年某月某日,判断这一天是这一年的第几天,并输出今年还剩多少天?
2022-12-14 17:53:57
644
原创 头插法建立单链表并实现输出
题目:头插法建立单链表并实现输出。#include "stdio.h"#include "stdlib.h"#include "string.h"typedef struct LNode{ int data; struct LNode *next;}LNode,*LinkList;LinkList List_HeadInsert(int *a,int len){ int i; LinkList L=(LinkList)malloc(sizeof(LNode)); L.
2022-05-07 11:49:28
2597
3
原创 从顺序表中删除其值在给定值s与t之间(要求是s<t)的所有元素,若s或t不合理或顺序表为空,则显示出错信息并退出运行。
题目:从顺序表中删除其值在给定值s与t之间(要求是s<t)的所有元素,若s或t不合理或顺序表为空,则显示出错信息并退出运行。#include "stdio.h"#define MaxSize 8typedef struct { int data[MaxSize]; int length;}SqList;bool delete_s_t(SqList &L,int s,int t){ int i,k=0; if(L.length==0||s>=t)...
2022-05-04 09:56:24
1044
1
原创 结构体的定义与使用
这里写自定义目录标题#include "stdio.h"#include "string.h"typedef struct Stu{ char name[20]; short age; char tele[12]; char sex[5];}Stu;void Print1(Stu tmp){ printf("name: %s\n",tmp.name); printf("age: %d\n",tmp.age); printf("tele: %s\n",tmp.tele);
2022-02-04 10:22:10
832
原创 用比较交换法实现排序
定义:将当前尚未排序的首位元素与其后的各元素比较交换#include "stdafx.h"#include "stdio.h"#include "stdlib.h"int _tmain(int argc, _TCHAR* argv[]){ int num[8]; int i,j; int t; for(i=0;i<8;i++) { scanf("%d",&num[i]); } for(i=0;i<7;i++) { for(j=i+1;j<.
2021-06-02 17:26:53
475
原创 在顺序表的第i个位置插入新元素
#include "stdafx.h"#include "stdio.h"#include "stdlib.h"#define Maxsize 10typedef struct{ int v[Maxsize]; int len;}sqlist; int insert(sqlist *L,int i,int x){ int j; if((*L).len==Maxsize) { printf("Overflow! \n"); return 0; } else .
2021-05-31 16:37:47
7955
原创 构造数据类型
#include "stdafx.h"#include "stdio.h"#define NAMESIZE 20#include "stdlib.h"struct date{ int year,month,day;};struct student{ long number; char name[NAMESIZE]; struct date birthday; int score;};int _tmain(int argc, _TCHAR* argv[]){ stru
2021-05-25 23:01:38
244
原创 依次将10个数输入,要求将其中最大的数输出
依次将10个数输入,要求将其中最大的数输出#include "stdafx.h"#include "stdio.h"int _tmain(int argc, _TCHAR* argv[]){ int num[10],i=0; printf("请输入10个数: "); for(i=0;i<10;i++) scanf("%d",&num[i]); printf("显示: "); for(i=0;i<10;i++) printf("%d ",num[i]); i
2021-05-22 22:36:30
1210
原创 求最大公约数——辗转相除法
辗转相除法1.如果b等于0,计算结束,a就是最大公约数;2.否则,计算a除以b的余数,让a等于b,而b等于那个余数3.回到第一步下面展示一些 内联代码片。package hello;import java.util.Scanner;public class Hello { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in=new Scanner(Syste
2021-02-04 00:14:24
499
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人