管理系统源码,V10业务管理系统源码
很多朋友对于管理系统源码和V10业务管理系统源码不太懂,今天就由小编来为大家分享,希望可以帮助到大家,下面一起来看看吧!
学生信息管理系统最简单源代码。
方法一:
1、创建一个c语言项目。然后右键头文件,创建一个Stu的头文件。
2、然后编写头文件的代码。再将数据结构的增删改查和结构体写入头文件。
3、然后在源文件中创建main源文件和Stu源文件。再main文件中写入intmian()代码。
4、然后在mian主函数中,写入while语句无限循环。再写入Init函数。
5、在Stu源文件的Init函数用printf语句,将学生管理系统输出。再创建链表的头节点head。
6、然后用switch函数对操作进行判断。再执行数据结构的增删改查功能。这样一个学生管理系统的基本框架就完成了。
方法二:
1、新建一个学生实体类,用于存放学生的各项信息。
2、新建一个链表节点类,每个节点存放一个学生信息及下一个节点的引用。
3、添加一个主操作类,并添加本系统的菜单方法。
4、定义链表的头节点,当前最后一个节点,以及主控制逻辑信息。
5、使用io流逐行读取存有学生信息的文本文件,对每行字符串,采用\t分割后得到一个字符串数组,数据各项即为一个学生的具体信息。然后新建一个节点加入到链表。
6、运行结果:
求一个C语言学生管理系统源代码
这是我今天写的一部分代码,领会精神。建议做链表时先画图分析一下数据结构,你可以先看一下别人的代码,先分析别人的代码,然后试试自己编一个简单的(没有参照的编程)。看一下数据结构方面的书会对你学习链表有很大的帮助。记着要勤加练习哦!
#include<iostream.h>
#include<fstream.h>
#include<iomanip.h>
#include<windows.h>
static int n;
struct student
{
int stu_number;
char stu_name[10];
char stu_sex[4];
int stu_age;
int math;
int english;
int cplu_plus;
int total;
float average;
};
class stu
{
student boy;
public:
int getnum();
void in_put(student*p1,int num);
void in_file(struct student*p,int number);
void readout(struct student*p);
void A_caculate(struct student*p);
void T_caculate(struct student*p);
int Cacu_aver(struct student*p,int number);
int Cacu_total(struct student*p,int number);
void out_put(struct student*p);
};
void stu::in_put(student*p1,int num)
{
int i;
for(i=0;i<num;i++)
{
cout<<"学号:"<<endl;
cin>>p1[i].stu_number;
cout<<"姓名:"<<endl;
cin>>p1[i].stu_name;
cout<<"性别:"<<endl;
cin>>p1[i].stu_sex;
cout<<"年龄:"<<endl;
cin>>p1[i].stu_age;
cout<<"数学成绩:"<<endl;
cin>>p1[i].math;
cout<<"英语成绩:"<<endl;
cin>>p1[i].english;
cout<<"c++成绩:"<<endl;
cin>>p1[i].cplu_plus;
p1[i].total=0;
p1[i].average=0;
system("cls");
}
}
void stu::in_file(struct student*p,int number)
{
int i;
ofstream ofs("feifei.txt",ios::out);
if(!ofs)
{
cerr<<"can not open the file!"<<endl;
exit(1);
}
else
{
for(i=0;i<number;i++)
{
ofs<<p[i].stu_number<<'\n'
<<p[i].stu_name<<'\n'
<<p[i].stu_sex<<'\n'
<<p[i].stu_age<<'\n'
<<p[i].math<<'\n'
<<p[i].english<<'\n'
<<p[i].cplu_plus<<'\n';
}
cout<<endl<<"data has been writen into the computer!"<<endl;
ofs.close();
}
}
void stu::readout(student*p)
{
int i,m;
ifstream ifs("feifei.txt",ios::in|ios::binary);
if(!ifs)
{
cerr<<"can not open the file!"<<endl;
exit(1);
}
else
{
for(i=0;i<n;i++)
{
}
}
ifs.close();
}
void stu::T_caculate(struct student*p)
{
int i,j;
struct student temp;
for(i=0;i<n;i++)
{
p[i].total=p[i].math+p[i].english+p[i].cplu_plus;
cout<<p[i].stu_name<<"的总成绩为:"<<p[i].total<<endl;
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(p[i].total>p[j].total)
{
temp=p[j];
p[j]=p[i];
p[i]=temp;
}
}
}
}
void stu::A_caculate(struct student*p)
{
int i,j;
struct student temp;
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(p[i].stu_age>p[j].stu_age)
{
temp=p[j];
p[j]=p[i];
p[i]=temp;
}
}
}
}
int stu::Cacu_aver(struct student*p,int number)
{
int i,flag=1;
for(i=0;i<n;i++)
{
p[i].average=(p[i].math+p[i].english+p[i].cplu_plus)/3.0;
if(p[i].stu_number==number)
{
cout<<p[i].stu_name<<"的平均成绩是"<<p[i].average<<endl;
flag=0;
}
}
if(flag!=0&&i==n)
{
cout<<"!您输入的号码不存在,请查证后重新输入"<<endl;
}
return flag;
}
int stu::Cacu_total(struct student*p,int number)
{
int i,flag=1;
for(i=0;i<n;i++)
{
p[i].total=p[i].math+p[i].english+p[i].cplu_plus;
if(p[i].stu_number==number)
{
cout<<p[i].stu_name<<"的总成绩是"<<p[i].total<<endl;
flag=0;
}
}
if(flag!=0&&i==n)
{
cout<<"-------------------!您输入的号码不存在,请查证后重新输入---------------"<<endl;
}
return flag;
}
void stu::out_put(struct student*p)
{
int i;
cout<<"student's information list here:"<<endl<<endl;
cout<<""<<setw(10)<<right<<"学号"<<""<<setw(8)<<left<<"姓名"<<setw(6)<<left<<"性别"<<setw(6)<<right<<"年龄";
cout<<setw(6)<<right<<"数学"<<setw(6)<<right<<"英语"<<setw(6)<<right<<"c++";
cout<<setw(8)<<right<<"总成绩"<<setw(10)<<right<<"平均成绩"<<endl;
for(i=0;i<n;i++)
{
cout<<"第"<<i+1<<"名"<<setw(10)<<right<<p[i].stu_number<<""<<setw(8)<<left<<p[i].stu_name;
cout<<setw(6)<<left<<p[i].stu_sex<<setw(6)<<right<<p[i].stu_age<<setw(6)<<right<<p[i].math;
cout<<setw(6)<<right<<p[i].english<<setw(6)<<right<<p[i].cplu_plus;
if(p[i].total!=0)
{
cout<<setw(8)<<right<<p[i].total;
}
if(p[i].average!=0)
{
cout<<setw(10)<<right<<p[i].average;
}
cout<<endl<<endl;
}
}
int main()
{
stu boy;
student*per,*outp;
int m;
cout<<"请从下面的菜单中选出您所要进行的操作选项:"<<endl<<endl;
do
{
cout<<"1.输入学生信息并保存到文件"<<endl;
cout<<"2.按年龄从大到小显示学生各项信息"<<endl;
cout<<"3.按各门成绩由高到低显示学生信息"<<endl;
cout<<"4.输入学号计算学生平均成绩并显示"<<endl;
cout<<"5.输入学号计算学生总成绩并显示"<<endl;
cout<<"6.按学生总成绩排名并显示排名结果"<<endl;
cout<<"7.退出所在系统"<<endl;
cin>>m;
system("cls");
switch(m)
{
case 1:
{
cout<<"please input the number of students you want to input:"<<endl;
cin>>n;
per=new student[n];
boy.in_put(per,n);
boy.in_file(per,n);
delete []per;
break;
}
case 2:
{
outp=new student[n];
boy.readout(outp);
boy.A_caculate(outp);
boy.out_put(outp);
delete[]outp;
break;
}
case 3:
{
outp=new student[n];
boy.readout(outp);
boy.T_caculate(outp);
boy.out_put(outp);
delete[]outp;
break;
}
case 4:
{
int number,flag;
char flag1;
outp=new student[n];
boy.readout(outp);
do
{
cout<<"please input the number of the students you want to find:"<<endl;
cin>>number;
flag=boy.Cacu_aver(outp,number);
if(flag==1)
{
cout<<"do you want to input again?'Y'/'N'"<<endl;
cin>>flag1;
}
else
break;
}
while(flag1=='y'||flag1=='Y');
boy.in_file(outp,n);
delete[]outp;
break;
}
case 5:
{
int number,flag;
char flag1;
outp=new student[n];
boy.readout(outp);
do
{
cout<<"please input the number of the students you want to find:"<<endl;
cin>>number;
flag=boy.Cacu_total(outp,number);
if(flag==1)
{
cout<<"do you want to input again?'Y'/'N'"<<endl;
cin>>flag1;
}
else
break;
}
while(flag1=='y'||flag1=='Y');
boy.in_file(outp,n);
delete[]outp;
break;
}
case 6:
{
outp=new student[n];
boy.readout(outp);
boy.out_put(outp);
break;
}
}
}
while(m!=7);
return 0;
}
简单的提示你一下,要自己多联系的,不然很难学好
C++商场销售管理系统 源代码
/*************************************************
问题补充:设计一个收银台结算程序:货品的信息有货品代码、
货品名称、货品价格、货品数量等,该程序能根据货品的输入代码
统计货品价格,对多个货品能做价格的累加统计并显示清单,
另具有找零功能。
需求:
1、实现对货品信息的输入和查询。
2、能根据货品的输入代码统计货品价格。
3、能对十个货品的价格统计并显示清单。
4、具有找零功能!
*************************************************/
//为了顺便练习一下使用链表结构,所以用链表结构实现。
//-----By kuaidh00--------2008/01/08-------------
//****************************************************
#include<iostream>
#include<string>
#include<iomanip>
#include<stdio.h>
using namespace std;
struct Sale
{
//数据域。
string m_code;
string m_name;
float m_price;
unsigned int m_quantity;
//指针域。
struct Sale* next;
};
typedef struct Sale Node;//取外别名,Node.
typedef Node* Link;//取个别名,Link.
//创建链表。
Link Create(Link Head)
{
//-----初始化头节点 Head-------
Head=(Link)new Node;//每次动态分配一个Node内存大小。
Head->m_code="";
Head->m_name="";
Head->m_price=0.0;
Head->m_quantity=0;
Head->next=NULL;
//-----
Link ptr;//定义一个用来运算的指针 ptr。
ptr=Head;//指到首节点。
Link DNode;//定义数据节点,用来存放数据。
char GoOn;
do
{
cout<<"商品信息录入!"<<endl;
string code,name;
float price;
unsigned int quantity;
cout<<"输入代码:"<<endl;
cin>>code;
cout<<"输入名称:"<<endl;
cin>>name;
cout<<"输入价格:"<<endl;
cin>>price;
while(cin.fail())
{
cout<<"请输入正确的格式:"<<endl;
cin.clear();
fflush(stdin);
cin>>price;
}
cout<<"输入数量:"<<endl;
cin>>quantity;
while(cin.fail())
{
cout<<"请输入正确的格式:"<<endl;
cin.clear();
fflush(stdin);
cin>>quantity;
}
//----数据域-----
DNode=(Link)new Node;//每次动态分配一个Node内存大小。
DNode->m_code=code;
DNode->m_name=name;
DNode->m_price=price;
DNode->m_quantity=quantity;
//----指针域-----
DNode->next=NULL;//作为尾节点加入。
ptr->next=DNode;//链入链表中。
ptr=DNode;//使新节点成为下一次的前驱。
cout<<"商品信息录入成功!是否继续录入?(Y/N)";
cin>>GoOn;
}while(GoOn=='Y'||GoOn=='y');
return Head;
}
//释放链表。
void Release(Link Head)
{
Link ptr;
while(Head!=NULL)
{
ptr=Head;
Head=Head->next;
delete ptr;
}
}
//查询。
Link Search(Link Head,string& code)
{
Link ptr;
//Link front;
ptr=Head;//定义一个用于操作的指针ptr。
//ptr=fornt->next;
while(ptr!=NULL)
{
if(ptr->m_code==code)
return ptr;
else
ptr=ptr->next;
}
cout<<"无此商品!"<<endl;
return ptr;//此时的ptr为NULL了。
}
//打印链表。
void Display(Link Head)
{
Link ptr;
ptr=Head->next;//,不要头节点,只输出数据节点。
cout<<"==========================================================="<<endl;
cout<<"===============所有商品信息清单============================"<<endl;
cout<<"==========================================================="<<endl;
cout<<"货品代码=======货品名称======货品价格======货品数量===="<<endl;
while(ptr!=NULL)
{
cout<<setw(15)<<left<<ptr->m_code
<<setw(15)<<left<<ptr->m_name
<<setw(15)<<left<<ptr->m_price
<<setw(15)<<left<<ptr->m_quantity<<endl;
ptr=ptr->next;
}
}
void Display_One(Link Head,string& code,unsigned quantity)
{
Link ptr;
ptr=Search(Head,code);//,不要头节点,只输出数据节点。
cout<<"货品代码=======货品名称======货品价格======货品数量======小计(元)===="<<endl;
cout<<setw(15)<<left<<ptr->m_code
<<setw(15)<<left<<ptr->m_name
<<setw(15)<<left<<ptr->m_price
<<setw(15)<<left<<quantity
<<setw(15)<<left<<quantity*ptr->m_price<<endl;
}
//单个商品小结。
float CheckOut(Link Head,string& code,unsigned quantity)
{
Link ptr;
float sum(0);
ptr=Search(Head,code);
sum=(ptr->m_price*quantity);
return sum;
}
//总结帐。
void Total(Link Head)
{
Link ptr;
ptr=Head;
float sum(0);
float factly;
char GoOn;
while(1)
{
cout<<"要结束商品买入请按\'N\',其它任意键表示继续买入!"<<endl;
cin>>GoOn;
if(GoOn=='N'||GoOn=='n')
break;
else
{
string code;
unsigned int quantity;
cout<<"输入要购买的商品代码:"<<endl;
cin>>code;
cout<<"输入要购买的数量:"<<endl;
cin>>quantity;
sum+=CheckOut(ptr,code,quantity);
cout<<"你购买的商品为:"<<endl;
Display_One(ptr,code,quantity);
}
}
cout<<"----------------------------------------------------"<<endl;
cout<<"你应该付"<<sum<<"元!"<<endl;
cout<<"你实际付(元):";
cin>>factly;
cout<<"应该找回你"<<factly-sum<<"元!"<<endl;//找零。
}
int main()
{
//---------菜单选项----------------
Link Head=NULL;
//Head=Create(Head);
int loop=1;
while(loop)
{
cout<<"***************************************************"<<endl;
cout<<"*---------------------菜单选项--------------------*"<<endl;
cout<<"*-------------------------------------------------*"<<endl;
cout<<"* 1.输入数据 2.买入商品 3.显示数据 0.退出系统*"<<endl;
cout<<"***************************************************"<<endl;
int menu;
cin>>menu;
if(cin.fail())
{
cout<<"请按菜单对应的数字选择合适的操作,谢谢合作!"<<endl;
cin.clear();
fflush(stdin);
cin>>menu;
}
switch(menu)
{
case 0:
cout<<"已退出系统!"<<endl;
loop=0;
break;
case 1:
Head=Create(Head);
break;
case 2:
Total(Head);
break;
case 3:
Display(Head);
break;
}//switch(menu)
}//while(loop)
//Display(Head);
//Total(Head);
Release(Head);
return 0;
}
END,本文到此结束,如果可以帮助到大家,还望关注本站哦!