Go开发工程师:迎接上升风口,踏入蓝海行业!
## download:[Go开发工程师:迎接上升风口,踏入蓝海行业!](http://www.97yrbl.com/t-492.html?_dsign=9d34012d)
## download:[Go开发工程师:迎接上升风口,踏入蓝海行业!](http://www.97yrbl.com/t-492.html?_dsign=9d34012d)
### Go开发工程师:迎接上升风口,踏入蓝海行业!
### 适合零基础小白学习吗
小同学,当你问出这句话的时候,就说明你已经不是小白了,你是个很有主见的“大人”了,要是你问零基础适合学习么?我肯定的告诉你:非常适合,而且要相信自己不是小白,而是小牛~祝你更进一步,加油~
课程中的项目是真的企业级/商业级项目么?
同学这个问题是我见过问得最有水平的问题了~ 确实网络上充斥了很多美其名曰“企业级/商业项目”,然而当你咨询想要体验一下项目效果,这么最低的标准都达不到,也就是网络充斥很多打着“企业级”名号的耍流氓项目,他们连最低的企业级标准--可部署可上线标准都达不到! 那么,同学想一下这个问题:什么样的标准才能称之为“企业级/商业级”?那么我认为有如下几点标准必须符合: 1、 【最低标准】可部署可上线(课程两个分别打开微信,搜索“租辆酷车”、“波哥电商”体验项目) 2、 真正的三端分离项目(两项目都符合,以微商城举例) 3、 满足企业真实的开发场景(以共享出行项目为例) (1) 先进的google设计理念+架构实践 (2) 符合当前最前卫的开发流程 (3) “敏捷开发”、“领域驱动DDD”等的最佳实践 4、 符合企业标准架构演进:从三端分离到微服务化项目迭代 (1) 微电商项目(前端+后端+后台管理-->搜索微服务化) (2) 共享出行项目(Typescript前端+后端+Vue3.0后台管理-->云原生微服务)
1.单个职工的头文件
staff.h
#ifndef STAFF_H_INCLUDED
#define STAFF_H_INCLUDED
//结构体创建
struct staff
{
char ID[10];
char name[10];
char sex[10];
int pay;
int reward;
int factpay;
};
//自定义结构体
typedef struct staff staff;
//单个职工信息创建
staff Createstaff();
//单个职工信息输出
void Displaystaff(staff staff);
//修改职工信息
void updatestaff(staff *Staff);
#endif // STAFF_H_INCLUDED
单个职工的cpp文件
staff.cpp
#include
#include
#include "staff.h"
staff Createstaff()
{
staff staff;
printf("-----------ID-----------\n");
scanf("%s", staff.ID);
printf("-----------name-----------\n");
scanf("%s", staff.name);
printf("-----------sex-----------\n");
scanf("%s", staff.sex);
printf("-----------pay-----------\n");
scanf("%d", &staff.pay);
printf("-----------reward-----------\n");
scanf("%d", &staff.reward);
staff.factpay = staff.pay + staff.reward;
printf("\n");
return staff;
}
void Displaystaff(staff staff)
{
printf("%10s", staff.ID);
printf("%10s", staff.name);
printf("%10s", staff.sex);
printf("%10d", staff.pay);
printf("%10d", staff.reward);
printf("%10d", staff.factpay);
printf("\n");
}
void updatestaff(staff *Staff)
{
printf("-----请显示要修改的数据--------\n");
Displaystaff(*Staff);
printf("-------请输入要修改的数据---------");
printf("-----------pay-----------\n");
scanf("%d", &Staff->pay);
printf("-----------reward-----------\n");
scanf("%d", &Staff->reward);
Staff->factpay = Staff->pay + Staff->reward;
printf("\n");
}
2.链表的创建
链表的头文件
linklist.h
#ifndef LINKLIST_H_INCLUDED
#define LINKLIST_H_INCLUDED
#include "staff.h"
//链表结点创建
struct Node
{
struct staff Staff;
struct Node *next;
};
//自定义结点
typedef struct Node node;
typedef struct Node *linklist;
//创建链表
node *Createlinklist();
//输出链表中的数据
void Displaylinklist(node *head);
//按职工号查找职工
node *searchnode(node *head, char ID[]);
//按姓名查找职工
void searchnodebyname(node *head, char name[]);
//删除职工
void delenode(linklist head, char ID[]);
//插入职工
void insertnode(linklist head, staff Staff);
//链表销毁
void distroylinklist(linklist head);
#endif // LINKLIST_H_INCLUDED
链表创建的源程序
linklist.cpp
#include
#include
#include
#include "staff.h"
#include "linklist.h"
node *Createlinklist()
{
node *head, *p;
head = (node *)malloc(sizeof(node));
head->next = NULL;
staff a[100] = {{"11111", "mmm", "f", 12000, 2000, 14000},
{"22222", "aaa", "m", 13000, 3000, 16000},
{"33333", "sss", "f", 15000, 3000, 18000},
{"44444", "fff", "m", 17000, 8000, 25000},
{"55555", "ggg", "f", 20000, 5000, 25000}};
for(int i = 0; i<5; i++)
{
p = (node *)malloc(sizeof(node));
p->Staff = a[i];
p->next = head->next;
head->next = p;
}
return head;
}
void Displaylinklist(node *head)
{
linklist p;
p = head->next;
while(p!=NULL)
{
Displaystaff(p->Staff);
p = p->next;
}
}
node *searchnode(node *head, char ID[])
{
linklist p;
p = head;
while(p!=NULL&&strcmp(p->next->Staff.ID, ID)!=0)
{
p = p->next;
}
return p->next;
}
void searchnodebyname(node *head, char name[])
{
linklist p;
p = head;
while((p!=NULL)&&(strcmp((p->next)->Staff.name, name)!=0))
{
p = p->next;
}
printf("-----´ËÈËΪ---------\n");
printf("%s", p->next->Staff.name);
printf("\n");
}
void delenode(linklist head, char ID[])
{
linklist p;
p = head;
while(p->next&&(strcmp(p->next->Staff.ID, ID)!=0))
{
p = p->next;
}
if(p->next)
{
p->next = p->next->next;
}
else
{
printf("=====NO FOUND========\n");
}
}
void insertnode(linklist head, staff Staff)
{
linklist p;
p = (node *)malloc(sizeof(node));
p->Staff = Staff;
p->next = head->next;
head->next = p;
}
void distroylinklist(linklist head)
{
linklist p;
p = head;
while(p!=NULL)
{
p = p->next;
free(p);
}
}
3.文件存盘
file.h
#ifndef FILE_H_INCLUDED
#define FILE_H_INCLUDED
#include "linklist.h"
#include "staff.h"
//职工信息存盘
void saveinformation(linklist head );
//职工信息加载
void loadinformation(linklist head );
#endif // FILE_H_INCLUDED
file.cpp
#include
#include
#include
#include "file.h"
#include "linklist.h"
#include "staff.h"
void saveinformation(linklist h )
{
FILE *fp;
linklist p;
if ( (fp = fopen("stu.txt","w") ) == NULL)
{
printf("Failure to open stu.txt!\n");
exit(0);
}
for ( p = h->next; p; p=p->next )
{
fwrite( &(p->Staff), sizeof(node), 1, fp);
}
fclose(fp);
}
void loadinformation( linklist h )
{
FILE *fp;
staff nodeBuffer;
if ((fp = fopen("stu.txt","r")) == NULL)
{
printf("\n\t数据文件丢失或为首次运行, 将加载测试数据\n");
return ;
}
while( fread(&nodeBuffer, sizeof(node), 1, fp)!=0 )
{
insertnode(h, nodeBuffer);
}
}
4.主函数
mainmeun.cpp
#include
#include
#include "linklist.h"
#include "staff.h"
#include "file.h"
void mainmeun(linklist head);
void searchmenu(linklist head);
int main(void)
{
linklist head=NULL;
//int n;
//printf("------请输入你要存的数据----------\n");
//scanf("%d", &n);
head = Createlinklist();
system("cls");
//Displaylinklist(head);
mainmeun(head);
printf("\n\n");
//loadinformation(head);
//saveinformation(head);
return 0;
}
void mainmeun(linklist head)
{
linklist p;
char ID[10];
//char name[10];
staff Staff;
int selection;
int flag = 1;
do
{
printf("=================职工管理系统===================\n");
printf("==========1.链表输出=====2.数据查询=====\n");
printf("=======3.数据删除===4.数据修改=====5.添加数据======\n");
printf("=======6.链表销毁===7.信息存盘=====8.放弃存盘=====\n");
printf("==================================================\n");
printf("======请选择功能(1~8):");
scanf("%d", &selection);
switch(selection)
{
case 1:
Displaylinklist(head);
break;
case 2:
searchmenu(head);
break;
case 3:
printf("=========请输入工号==========\n");
scanf("%s", ID);
delenode(head, ID);
break;
case 4:
printf("=========请输入工号==========\n");
scanf("%s", ID);
p = searchnode(head, ID);
updatestaff(&(p->Staff));
break;
case 5:
printf("========添加数据=========");
Staff = Createstaff();
insertnode(head, Staff);
break;
case 6:
distroylinklist(head);
break;
case 7:
loadinformation(head);
saveinformation(head);
break;
case 8:
flag = 0;
break;
}
}while(flag == 1);
printf("========BYE=====BYE======");
}
void searchmenu(linklist head)
{
linklist p;
int flag = 1;
char ID[10];
char name[10];
do
{
printf("=========查找菜单===========\n");
printf("===1.ID======2.name====3.退出====\n");
printf("=================================\n");
int selection;
printf("==请选择功能(1~3):");
scanf("%d", &selection);
switch(selection)
{
case 1:
printf("=====请输入ID=======\n");
scanf("%s", ID);
p = searchnode(head, ID);
Displaystaff(p->Staff);
break;
case 2:
printf("=====请输入name======\n");
scanf("%s", name);
searchnodebyname(head, name);
break;
case 3:
flag = 0;
break;
}
system("pause");
system("cls");
}while(flag == 1);
}