![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c/c++
confectionary
这个作者很懒,什么都没留下…
展开
-
头文件
************************#include<bits/stdc++.h>************************#include<cstdio> #include<cstring> #include<algorithm> #include<iostream> #include<string> #include<vector> #include<stack>原创 2021-05-06 19:48:44 · 102 阅读 · 0 评论 -
顺序结构储存字符串,BF算法
使用顺序结构存储字符串,完成字符串基本操作:如初始化、求长度、字符串连接等;扩展模式匹配的BF算法(只能实现匹配主串中第一次出现的位置),使其能找出主串中出现模式串的所有位置信息。(主函数直接赋值,无输入)#include<stdio.h>#include<stdlib.h>#include<iostream>#define MAXLEN 255typedef struct string //顺序串的结构体{ char ch[MAXLEN+1原创 2021-05-06 19:21:13 · 762 阅读 · 0 评论 -
顺序表基本操作
顺序表的基本操作:构造空顺序表,创建顺序表,插入元素,删除元素,在表中查找最大的元素,输出,冒泡排序。#include<stdio.h>#include<stdlib.h>#define OK 1#define ERROR -1#define MAXSIZE 1024//顺序表可能达到的最大长度typedef int Num;typedef struct{ Num *elem;//存储空间基地址 int length;//当前长度}SqList;//原创 2021-05-06 19:10:42 · 134 阅读 · 0 评论 -
打印指定月份月历
先看运行结果话不多说上代码#include<cstdio>#include<cstdlib>#include<cstring>#include<ctime>#define _CRT_SECURE_NO_WARNINGS 1int mon[2][13] = {{ 0,31,28,31,30,31,30,31,31,30,31,30,31},{0,31,29,31,30,31,30,31,31,30,31,30,31}};//二维数组 //判断原创 2020-12-08 17:21:04 · 772 阅读 · 0 评论 -
c程序,输出规范图形,输出沙漏图形(课后题改)
直接放代码了#include<stdio.h>int main(){ int a,b,c; printf("输入意向数字\n"); scanf("%d",&a); int n=a; for(a;a>=1;a--) { for(c=a-1;c<n;c++) { printf(" "); } for(b=1;b<=2*a-1;b++) { printf("*"); } printf("\n"); } for(a=2原创 2020-12-08 17:03:12 · 1150 阅读 · 1 评论 -
统计字母,空格,数字以及其他字符的个数
c/c++都可以用,课后题#include <stdio.h>int main(){ int a,b,c,d,ch; a=b=c=d=0;//数字a,字母b,空格c,其他d; printf("请输入所需统计字符串,用换行键结束\n"); while((ch=getchar())!='\n')//用getchar输入,输入enter换行时结束输入。 { if(ch>='0' && ch<='9')原创 2020-12-08 16:56:23 · 762 阅读 · 1 评论