一个简单的系统

小菜鸡初接触shell写的第一个脚本,没有什么技术含量,留个纪念,如果给各位提供了丁点思路深感荣幸。

源码:

#! /usr/bin/bash
clear
echo
echo "###################################################################"
echo "# this is a bash-shell system write by lee                        #"
echo "# this  procedure is a system 简单系统                            #"
echo "#              version 1.1.1.20200421                             #"
echo "###################################################################"
#this function is lianxiren
return_lianxiren(){
       echo '**lianixrenxinxi******'
       cat lianxiren.txt
       read -p "Enter name like: "

                   head lianxiren.txt |grep -n $REPLY
                   echo '********1.return_shouye******'
                   echo '******2.return_lianxiren*****'
                   echo '*************0.exit**********'
                   read -p "Enter your chose: "
         if [ $REPLY -eq 1 ]
           then return_shouye
         elif [ $REPLY -eq 2 ]
           then return_lianxiren
         elif [ $REPLY -eq 0 ]
           then echo 'good bye man.'
         else
           echo 'your chose is failed!!!'
           return_lianxiren
         fi
}
#this function is shouye
return_shouye(){ 
echo   '*********shouye**********'
echo   '****1.pactera_jianjie****'
echo   '****2.lianxiren_chaxun***'
echo   '****3.lianxiren_xiugai***'
echo   '*******0.exit************'

read -p "Enter your chose: "

if   [ $REPLY -eq 1 ]
      then
       cat pactera_jianjie.txt
       echo '********1.return******'
       echo '*********0.exit*******'
       read -p "Enter your chose: "
         if [ $REPLY -eq 1 ]
           then return_shouye
         elif [ $REPLY -eq 0 ]
           then echo 'good bye man.'
         else
           echo 'your chose is failed!!!'
           return_jianjie
         fi
elif [ $REPLY -eq 2 ]
      then
       echo '**lianixrenxinxi******'
       cat lianxiren.txt
       read -p "Enter name like: "

                   head lianxiren.txt |grep -n $REPLY
                   echo '********1.return_shouye******'
                   echo '******2.return_lianxiren*****'
                   echo '*************0.exit**********'
                   read -p "Enter your chose: "
         if [ $REPLY -eq 1 ]
           then return_shouye
         elif [ $REPLY -eq 2 ]
           then return_lianxiren
         elif [ $REPLY -eq 0 ]
           then echo 'good bye man.'
         else
           echo 'your chose is failed!!!'
           return_lianxiren
         fi

elif [ $REPLY -eq 3 ]
      then
       vi lianxiren.txt
       return_shouye
       read -p "Enter your chose: "

elif [ $REPLY -eq 0 ]
      then
       exit
else
       echo 'your chose is failed!!!'
       return_shouye
fi }

return_jianjie (){
       cat pactera_jianjie.txt
       echo '********1.return******'
       echo '*********0.exit*******'
       read -p "Enter your chose: "
         if [ $REPLY -eq 1 ]
           then return_shouye
         elif [ $REPLY -eq 0 ]
           then echo 'good bye man.'
         else
           echo 'your chose is failed!!!'
           return_jianjie
         fi
}


##shuchushouye
echo   '*********shouye**********'
echo   '****1.pactera_jianjie****'
echo   '****2.lianxiren_chaxun***'
echo   '****3.lianxiren_xiugai***'
echo   '*******0.exit************'

read -p "Enter your chose: "

if   [ $REPLY -eq 1 ]
      then
       cat pactera_jianjie.txt
       echo '********1.return******'
       echo '*********0.exit*******'
       read -p "Enter your chose: "
         if [ $REPLY -eq 1 ]
           then return_shouye
         elif [ $REPLY -eq 0 ]
           then echo 'good bye man.'
         else
           echo 'your chose is failed!!!'
           return_jianjie           
         fi
elif [ $REPLY -eq 2 ]
      then
       echo '**lianixrenxinxi******'
       cat lianxiren.txt
       read -p "Enter name like: "
                
                   head lianxiren.txt |grep -n $REPLY
                   echo '********1.return_shouye******'
                   echo '******2.return_lianxiren*****'
                   echo '*************0.exit**********'
                   read -p "Enter your chose: "
         if [ $REPLY -eq 1 ]
           then return_shouye
         elif [ $REPLY -eq 2 ]
           then return_lianxiren
         elif [ $REPLY -eq 0 ]
           then echo 'good bye man.'
         else
           echo 'your chose is failed!!!'
           return_lianxiren
         fi

elif [ $REPLY -eq 3 ]
      then
       vi lianxiren.txt 
       return_shouye
       read -p "Enter your chose: "


elif [ $REPLY -eq 0 ]
      then
       exit              
else 
       echo 'your chose is failed!!!'
       return_shouye
fi
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
制作一个简易系统需要考虑很多因素,包括系统的目标、功能和设计等,因此在这里我只能给出一个简单的示例,帮助你了解如何使用C++来开发一个系统。 假设我们要实现一个简单的学生成绩管理系统,实现以下功能: - 添加学生信息 - 删除学生信息 - 修改学生信息 - 查询学生信息 - 显示所有学生信息 首先,我们需要定义一个学生类,用于存储学生的姓名、学号和成绩等信息。代码如下: ```c++ class Student { public: string name; // 学生姓名 int id; // 学生学号 int score; // 学生成绩 Student(string name, int id, int score) { this->name = name; this->id = id; this->score = score; } }; ``` 接下来,我们需要实现一个学生信息管理类,用于实现上述功能。代码如下: ```c++ class StudentManager { private: vector<Student> students; // 学生信息列表 public: // 添加学生信息 void addStudent(Student student) { students.push_back(student); } // 删除学生信息 void removeStudent(int id) { for (auto it = students.begin(); it != students.end(); it++) { if (it->id == id) { students.erase(it); break; } } } // 修改学生信息 void modifyStudent(int id, Student student) { for (auto& s : students) { if (s.id == id) { s = student; break; } } } // 查询学生信息 Student* queryStudent(int id) { for (auto& s : students) { if (s.id == id) { return &s; } } return nullptr; } // 显示所有学生信息 void displayAllStudents() { for (auto& s : students) { cout << "name: " << s.name << ", id: " << s.id << ", score: " << s.score << endl; } } }; ``` 最后,我们可以在主函数中使用这个学生信息管理类来实现学生成绩管理系统。代码如下: ```c++ int main() { StudentManager manager; // 添加学生信息 manager.addStudent(Student("张三", 1001, 90)); manager.addStudent(Student("李四", 1002, 85)); manager.addStudent(Student("王五", 1003, 95)); // 修改学生信息 manager.modifyStudent(1002, Student("赵六", 1004, 88)); // 删除学生信息 manager.removeStudent(1003); // 查询学生信息 Student* student = manager.queryStudent(1001); if (student != nullptr) { cout << "name: " << student->name << ", id: " << student->id << ", score: " << student->score << endl; } // 显示所有学生信息 manager.displayAllStudents(); return 0; } ``` 这个简单的示例演示了如何使用C++来实现一个简单系统。但是,实际上,真正的系统开发需要考虑更多的因素,如数据存储、用户界面设计、安全性等,需要使用更加完整和复杂的框架和工具来实现。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

D2cOneluo

万一有大佬给个打赏呢,对不对。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值