我的学习记录36
来源:互联网 发布:手机相片日期软件 编辑:程序博客网 时间:2024/06/06 00:17
2017.11.15李锦浩【第36天】
今天完成了前天未完成的程序,由于时间原因没能挑食完成,可能还存在着一部分编译问题,需要进一步找寻bug。另外今天学习了关于类的定义和知识。
附:职工统计表:
//luru.h
#pragma once
#include<iostream>
using namespace std;
struct Node
{
char name[64];
unsigned int id;
int age;
int sex;
Node*next;
};
void CreateList(Node*&head)
{
cout << "请输入总人数:";
int n;
cin >> n;
Node*s,*p;
s = new Node;
p = new Node;
cout << "请输入姓名:";
cin >> s->name;
cout << "请输入工号:";
cin >> s->id;
cout << "请输入年龄:";
cin >> s->age;
cout << "请输入性别,1表示男,2表示女:";
cin >> s->sex;
for(int o=1;o<=n;)
{
if (head ==NULL)
head = s;
else
{
p->next = s;
p = s;
s = newNode;
cout <<"请输入姓名:";
cin >> s->name;
cout <<"请输入工号:";
cin >> s->id;
cout <<"请输入年龄:";
cin >> s->age;
cout <<"请输入性别,1表示男,2表示女:";
cin >> s->sex;
}
}
p->next = NULL;
delete s;
delete p;
}
void ShowList(Node*head)
{
while (head->next)
{
cout << head->name << endl << head->id << endl<< head->age << endl << head->sex;
head = head->next;
}
cout << endl;
}
void insert(Node*head)
{
Node*s;
s = new Node;
cout << "请输入姓名:";
cin >> s->name;
cout << "请输入工号:";
cin >> s->id;
cout << "请输入年龄:";
cin >> s->age;
cout << "请输入性别,1表示男,2表示女:";
cin >> s->sex;
while (!head->next)
{
head = head->next;
}
head->next = s;
delete s;
}
void statustics(Node*head)
{
int man = 0, woman = 0;
while (!head->next)
{
if (head->sex == 1)
man++;
if (head->sex == 2)
woman++;
head = head->next;
}
cout << "男员工人数为"<< man << endl << "女员工人数为"<< woman<<endl;
}
void deleteid(Node*head)
{
cout << "请输入想要删除的工人ID编号:";
unsigned int i;
cin >> i;
while (head->next)
{
Node*s;
if (head->id == i)
{
s = head->next;continue;
}
s = head;
head = head->next;
}
head = head->next;
}
void deletex(Node*head,Node*p)
{
while (head->next)
{
Node*s;
s = head;
head = head->next;
if (head->sex == 1)
{
if (head->age >60)
{
p->next =head;
p =head;
s = head->next;
}
}
if (head->sex == 2)
{
if (head->age >55)
{
p->next =head;
p =head;
s = head->next;
}
}
}
}
void ShowListx(Node*p)
{
while (p)
{
cout << p->name << endl <<p->id<< endl << p->age << endl <<p->sex;
p = p->next;
}
cout << endl;
}
//yuan.cpp
#include<iostream>
#include"录入.h"
using namespace std;
int main()
{
Node*head=NULL, *p=NULL;
CreateList(head);
ShowList(head);
insert(head);
deleteid(head);
deletex(head, p);
ShowListx(p);
system("pause");
return 0;
}
明日任务:继续编写关于集合的程序,学习类的知识。
- 我的学习记录36
- 我的学习记录
- 我的学习记录
- 我的学习记录
- 记录生活,记录学习----我的2016
- 开始我的学习记录
- 记录我的学习过程
- 我的OGRE学习记录
- 我的oracle学习记录
- 我的PHP学习记录。
- 我的Linux学习记录
- 记录我的学习历程
- 记录我的Android学习
- 记录我的学习过程
- [cocos2dx]我的学习记录
- 记录我的学习过程
- 我的学习记录整理
- 我的Golang学习记录
- 自己写的Spring4教程,给Java学习者参考!
- 深入浅出Signals综合分析
- Android Studio手动配置Gradle的方法
- pip install pysftp出现的错误
- 查看ip地址是否被占用
- 我的学习记录36
- ffmpeg系列打开ffmpeg格式转换和缩放器
- 理解 ES6 Generator 函数
- ..\SYSTEM\usart\usart.c(41): error: #260-D: explicit type is missing ("int" assumed)
- 前端js 常用积累
- 12.2、拦截器配置和执行顺序
- jQuery 选择器
- 深度学习之基础模型-SEP-Nets
- Python 随笔1