当前位置:网站首页>个人信息管理系统
个人信息管理系统
2022-07-17 05:21:00 【winkiii】
描述
小张是同学会的负责人,但是复杂的联系信息让他很头痛,请你帮他写一个个人信箱的管理系统(人数小于30人),每个人包含3项信息:
姓名 (小于20个字符) 性别(Female = 女, Male = 男) 生日(年月日)
每个人用一个结构体表示,同时支持以下操作:
add Tim Male 1993 12 22
添加一个名为Tim的男生,出生年月日位1993-12-22
name Tim
返回姓名为Tim的人的所有信息
sex Male
返回所有男生的信息(sex Female返回女生信息)
quit
退出系统
输入
用户指令
输出
输出结果
输入样例 1
add Tim Male 1993 12 22
add Britney Female 1992 2 23
add Freddy Male 1989 4 22
name Britney
sex Male
quit
输出样例 1
Britney Female 1992-2-23
Tim Male 1993-12-22
Freddy Male 1989-4-22
#include<string.h>
#include<stdio.h>
struct{
char name[100];
char sex[10];
int year;
int month;
int day;
}stu[30];
int main(){
char s[10];
int i=0;
while(1)
{
scanf("%s",s);
if(strcmp(s,"quit")==0){
break;
}
if(strcmp(s,"add")==0){
scanf("%s%s%d%d%d",&stu[i].name,&stu[i].sex,&stu[i].year,&stu[i].month,&stu[i].day);
i++;
}
if(strcmp(s,"name")==0){
char b[100];
scanf("%s",b);
for(int j=0;j<i;j++){
if(strcmp(b,stu[j].name)==0){
printf("%s %s %d-%d-%d\n",stu[j].name,stu[j].sex,stu[j].year,stu[j].month,stu[j].day);
}
}
}
if(strcmp(s,"sex")==0){
char a[10];
scanf("%s",a);
for(int j=0;j<i;j++){
if(strcmp(a,stu[j].sex)==0){
printf("%s %s %d-%d-%d\n",stu[j].name,stu[j].sex,stu[j].year,stu[j].month,stu[j].day);
}
}
}
}
}
边栏推荐
- 基于I2C的温度采集实验及实验心得
- Experiment 3 inheritance and derived classes
- Programming learning based on ardunio ide software development
- 关于STM汇编程序设计相关学习
- X11 forwarding
- Causes and solutions of over fitting
- 《PyTorch深度学习实践》-B站 刘二大人-day3
- Drawing PCB with Altium Designer
- Top command
- Preparation of blast Library of rust language from scratch (1) -- Introduction to the basics of blas
猜你喜欢
随机推荐
明明爱喝水
关于STM汇编程序设计相关学习
F5ltm (I) logic diagram
网络层及ip学习
Seachest utilities tool enables your hard disk to consume less power and live longer
Release nohup Out disk space occupied
Pytorch deep learning practice-b station Liu erden-day5
Part of the second Shanxi Network Security Skills Competition (Enterprise Group) WP (III)
Wu Enda machine learning chapter 14-15
Cygwin cooperates with listary to switch the current directory and quickly open it
Total price contract, cost compensation contract, labor contract
Vcenter6.7安装及排错
notepad++下划线以及大小写字母置换
小迪网络安全笔记-信息收集-架构、搭建、waf(8)
Technical specification for secure electronic signature and password gm/t 0031 | GB / T 38540 format OpenSSL package analysis
Loadng class `com. mysql. jdbc. Driver‘. This is deprecated. The new driver class is `com. mysql. cj. jdb
Share the successful cooperation between CS brand sdnand and wearable devices
BigDecimal中divide方法
Information on successful cooperation between CS brand sdnand and stm32mcu
机器学习篇-逻辑回归的分类预测







![[jmeter] TCP Sampler](/img/ac/3b08db8808d84eb144262d78880050.png)

