首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

学生管理系统程序(c++)

2012-03-08 
求一个学生管理系统程序(c++)RT....写的漂亮的,界面简洁的[解决办法]C/C++ code#includeiostreamusing n

求一个学生管理系统程序(c++)
RT....写的漂亮的,界面简洁的

[解决办法]

C/C++ code
#include  <iostream> 
using namespace std;
typedef struct lnode
{
long sno;
char name[20];
float score[3];
struct lnode *next;
}LNode, *LinkList;
LinkList InitList()
{
LinkList head;
head = new LNode;
head->next = NULL;
cout < <"Initialization completed!" < <endl;
return head;
}
LinkList CreateList()
{

int i, n, j;
cout < <"Input data number:";
cin>>n;
  LinkList q, p, head;
head = new LNode;
head->next = NULL;
q = head;
for (i = 0; i < n; i++)
{
p = new LNode;
cout < <"Input Information:" < <endl < <"Sno";
cin>>p->sno;
cout < <"name:";
cin>>p->name;
for (j=0; j <3; j++)
{
      cout < <"Score [" < <j < <"]";
cin>>p->score[j];
}
p->next = NULL;
q->next = p;
q = p;
}

  return (head);
}

void ListInsert(LinkList &L)
{
int i, j, k;
LinkList p, s;
p = L;
j = 0;
cout < <"Input Location:" < <endl;
cin>>i;
while (p->next != NULL && j <i-1)
{
p = p->next;
j++;
}
if (j != i-1)
{
cout < <"You made a wrong location!" < <endl;
return;
}
s = new LNode;
cout < <"Input Information:" < <endl
< <"Sno:";
cin>>s->sno;
cout < <"name:";
cin>>s->name;
for (k=0; k <3; k++)
{
      cout < <"Score [" < <k < <"]";
cin>>s->score[k];
}
s->next = p->next;
p->next = s;
}
void GetElem(LinkList L)
{
LinkList p;
int i, j;
p = L;
j = 0;
cout < <"Input data Location:";
cin>>i;
while (p->next != NULL && j < i)
{
p = p->next;
j++;
}
if (p != NULL && j==i)
{
cout < <"You got information:" < <endl
< <p->sno < <endl
< <p->name < <endl
< <p->score[0] < <endl
< <p->score[1] < <endl
< <p->score[2] < <endl;
}
else
cout < <"ERROR!" < <endl;
}
void ListDelete(LinkList &L)
{
int i, j;
LinkList p, s;
p = L;
j = 0;
cout < <"Input Location:";
cin>>i;
while (p->next != NULL && j <i-1)
{
p = p->next;
j++;
}
if (j != i-1)
{
cout < <"You made a wrong location!" < <endl;
return;
}
s = p->next;
p->next = s->next;
delete s;
}
void main()
{
LinkList L;
char ch;
cout < <"--------------------------------------------------" < <endl
  < <"-                        -" < <endl
  < <"-    Students Management System      -" < <endl
  < <"-    ...................................    -" < <endl


  < <"-                        -" < <endl
< <"-      1.Init Linklist          -" < <endl
  < <"-      2.Create a Linklist        -" < <endl
  < <"-      3.Insert information        -" < <endl
  < <"-      4.Find data            -" < <endl
  < <"-      5.Delete data            -" < <endl
  < <"-      6.Exit              -" < <endl
  < <"-                        -" < <endl
  < <"--------------------------------------------------" < <endl;

while(1)
{
  cin>>ch;
switch (ch)
{
  case '1' : L = InitList() ; break;
case '2' : L = CreateList() ; break;
  case '3' : ListInsert(L) ; break;
case '4' : GetElem(L) ; break;
case '5' : ListDelete(L) ; break;
case '6' : exit(1) ; break;
default : cout < <"You get a wrong operation!"; exit(1); break;
}
cout < <"** Operation List: 1. Init  2.Creat  3.Insert  4.Find  5.Delete  6.Exit **" < <endl;
}
 
system("pause");
}




LZ...作业还是要自己做啊

热点排行