自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(19)
  • 收藏
  • 关注

原创 2021-04-27

读取in.txt文件数据,对数据进行排序输出到out.txt #include “stdafx.h” #include #include #include //sort() using namespace std; bool cmp(int x, int y) { return y < x; } int a[1000];//存放从文本中读取到的数字 int main() { ifstream file(“in.txt”);//当前路径下自己创建一个,随变写入些数据 if (!file) { cou

2021-04-27 18:04:30 47

原创 2021-03-13

/文件大小转换/,参数是io.h头文件fileinfo.size const char *toBigUnit(double val) { static char *unit[] = { “B”, “KB”, “MB”, “GB” }; static char buffer[128]; int idx = 0; while (val > 800) { val /= 1024; ++idx; } sprintf_s(buffer, 128, “%.2f%s”, val, unit[idx]); retur

2021-03-13 10:46:44 35

原创 2021-03-09

数据库简单操作,主要记下赋予用户权限! create user yue identified by yue123;数据库创建子用户 并密码! create tablespace yuet datafile ‘D:\yuechuqian.dbf’ size 200M;创建200M的数据文件, alter user yue default tablespace yuet; grant create session,create table,create view,create sequence,unlimite

2021-03-09 17:55:04 34

原创 2021-03-02

3-2号发布的都是链表相关操作,希望可以帮到你学习!

2021-03-02 19:11:28 56

原创 2021-03-02

void sort_link(Linklist * phead)///////链表排序 { Linklist * first = NULL; Linklist * second = NULL; Linklist * third = NULL; Linklist * end = NULL; Linklist * temp = NULL; if(phead == NULL||phead->next == NULL) { puts(“无法排序\n”); return; } while(phead->n

2021-03-02 19:10:10 37

原创 2021-03-02

void de_weight(Linklist * phead)///////////链表去重 { Linklist * p = NULL; Linklist * q = NULL; Linklist * temp = NULL; int count = 0; if(phead == NULL||phead->next == NULL) { puts(“无法去重\n”); return; } p = phead->next;//指向首节点 while(p->next != NULL) {

2021-03-02 19:09:36 42

原创 2021-03-02

void backword(Linklist * phead)////////链表逆序 { Linklist * p = NULL; Linklist * pnew = NULL; Linklist * temp = NULL; if(phead == NULL || phead->next == NULL) { puts(“指针为空\n”); return; } pnew = phead->next;//指向首节点 temp = pnew->next;//temp记录第一个插入的节点地址

2021-03-02 19:08:57 40

原创 2021-03-02

void insert_value(Linklist * phead,int number,char * str)//////////插入数据 { Linklist * pnew = NULL; Linklist * p = phead; Linklist * temp = NULL; if(phead == NULL) { puts(“add指针为空\n”); return; } pnew = (Linklist *)malloc(sizeof(Linklist)); strcpy(pnew->na

2021-03-02 19:08:27 42

原创 2021-03-02

void delete_node(Linklist * phead,int number)/////删除节点 { Linklist * temp = NULL; Linklist * p = phead; temp = phead; if(phead == NULL || phead->next == NULL) { puts(“delet指针为空\n”); return; } while(p->next) { temp = p->next; if(temp->number ==

2021-03-02 19:07:45 34

原创 2021-03-02

void find(Linklist * phead,int number,char * str)//修改//将number对应的名字“月初浅”改为“月微凉”,姓不变,只改名字 { Linklist * temp = NULL; if(phead == NULL) { puts(“头指针为空\n”); return; } temp = phead->next;//跳过头节点; while(temp) { if(temp->number == number) { strcpy(temp->n

2021-03-02 19:07:01 34

原创 2021-03-02

void traverse(Linklist *phead)////////输出链表也可以用来统计链表个数 { Linklist * temp = NULL; if(phead == NULL) { puts(“头指针为空\n”); return; } temp = phead->next;//跳过头节点; while(temp) { printf("%d\t%s\n",temp->number,temp->name); temp = temp->next; } } ...

2021-03-02 19:06:22 36

原创 2021-03-02

Linklist * phead=NULL;//定义头指针 int n = 0; int allnumber = 0; char str[100]={0}; int number = 0; puts(“请输入要创建的节点个数:”); scanf("%d",&n); create_list(n,&phead);////创建节点,并赋值 void create_list(int n,Linklist **phead)///////////创建链表 { int i = 0; Linklist *

2021-03-02 19:04:31 29

原创 2021-02-27

/////读取文件,按照要求生成新的TXT文件 typedef struct student { char name[10]; int age; float score[4]; }stu; int input(stu * arr,char * path) { int n = 0; FILE * fp = NULL; fp = fopen(path,“r”); if(!fp) { puts(“文件打开失败”); exit(0); } while(!feof(fp)) { fscanf(fp,"%s%d%f%f

2021-02-27 17:43:18 42

原创 2021-02-26

/////妈妈找宝宝,1010矩阵,由数字-1,-2,-3,0以及正整数组成,其中,-2表示MUM的位置,-3表示BABY的位置, //-1表示此路不通,0表示此路能走,但没有糖果,正整数表示可以走通还可以获得相对应的糖果数, ///求出:mum找到BABY的所有路径中,路径最短的并输出对应的糖果数,如多路径相同,输出糖果数较多的, ///如果不能找到BABY,输出-1;(程序保证只有一个-2和-3) //例子:55 3 -1 0 -2 6,3 4 5 0 6,1 4 8 7 2,7 2 5 -1 3,

2021-02-26 12:52:40 74

原创 2021-02-26

///输入一个字符串。找出其中不重复的最长子串---------------滑动窗口 /* int lookstr(char *str) { int size = 0; int num = 0; int j = 0; int k = 0; int i = 0; size = strlen(str); for(j=0;j<size;j++) { for(k=i;k<j;k++) { if(str[k]==str[j]) { i=k+1; break;////找到相同的字符 } } num=num&

2021-02-26 12:51:01 42

原创 2021-02-26

//动态分配二维数组的两种方式 /* int main() { int i = 0; int j = 0; int ** p = NULL; p = (int **)malloc(sizeof(int *) * 4); for(i = 0; i < 4; i++) { p[i] = (int *)malloc(sizeof(int) * 4); } for(i = 0; i <4; i++) { for(j = 0; j < 4; j++) { scanf("%d",&p[i][j

2021-02-26 12:50:30 37

原创 2021-02-26

void main()///////////////////水仙花______________穷举 { int a = 0; int b = 0; int c = 0; int d = 0; for(d=100;d<=999;d++) { a = d/100; b = d/10%10; c = d%10; if(aaa+bbb+ccc==d) { printf("%d\n",d); } } }

2021-02-26 12:49:25 49

原创 2021-02-26

/////递归////计算小岛面积,给定10*10矩阵,1表示浮出水面,0表示水面,1的上下左右为1.则小岛连通。 ////////////问:1.有几个小岛?2.小岛的面积是多少?3.输出每个小岛的最左边界,最右边界,最上边界,最下边界? void border(int arr[][10],int h,int l,int*p) { arr[h][l] = 0; p[0]+=1; if(arr[h+1][l]==1&&h+1<=9)//向下走 { p[4] = p[4]>h+1?

2021-02-26 12:45:01 101

原创 2021-02-26

/////////////////有水果名(英文),有工人编号,有水果重量,按照水果重量排序,如果相等在按照编号排序 struct serial { int bianhao; int zhongliang; }; struct fruits { char fruitsname[20]; struct serial b[10]; int count; }; void outstruct(struct fruits *stu) { int temp1 = 0; int temp2 = 0; int i = 0;

2021-02-26 12:42:40 110

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除