C++一个程序出错了,求高手解答
#ifndef _STUDENT#define _STUDENT
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
#define SIZE 80
class Student
{
string name;
string ID;
string number;
string speciality;
int age;
public:
Student();
Student(string na,string id,string num,string spec,int ag);
Student(const Student &per);
~Student();
string GetName();
string GetID();
string GetNumber();
string GetSpec();
int GetAge();
void Display() const;
void Input();
bool Insert( );
};
#endif
#include"example7_19_Student.h"
Student::Student()
{
age=0;
}
Student::Student(string na,string id,string num,string spec,int ag)
{
name=na;
ID=id;
number=num;
speciality=spec;
age=ag;
}
Student::Student(const Student &per)
{
name=per.name;
ID=per.ID;
number=per.number;
speciality=per.speciality;
age=per.age;
}
Student::~Student()
{}
string Student::GetName()
{
return name;
}
string Student::GetID()
{
return ID;
}
int Student::GetAge()
{
return age;
}
string Student::GetSpec()
{
return speciality;
}
string Student::GetNumber()
{
return number;
}
void Student::Display() const
{
cout<<"姓名"<<name<<endl;
cout<<"身份证"<<ID<<endl;
cout<<"学号"<<number<<endl;
cout<<"专业"<<speciality<<endl;
cout<<"年纪"<<age<<endl<<endl;
}
void Student::Input()
{
cin.get();
cout<<"输入姓名";
getline(cin,name);
cin.get();
cout<<"输入身份证";
getline(cin,ID);
cin.get();
cout<<"输入专业";
getline(cin,speciality);
cout<<"输入年龄";
cin.get();
cin>>age;
}
#include<iostream>
#include<vector>
#include<algorithm>
#include"example7_19_Student.h"
using namespace std;
void menu();
void OutputStu(vector<Student>& stu_vec);
void InputStu(vector<Student>& stu_vec);
int main()
{
vector<Student> stu_vec;
int choice;
string na;
do
{
menu();
cout<<"输入选择";
cin>>choice;
if(choice>=0 && choice<=3)
switch(choice)
{
case 1:InputStu(stu_vec);
break;
case 2:cout<<"输入名字查找"<<endl;
cin.get();
getline(cin,na);
cin.get();
vector<Student>::iterator p;
for(p=stu_vec.begin();p!=stu_vec.end();p++)
{
if(((*p).GetName()).compare(na)==0)
{
(*p).Display();
break;
}
}
if(p==stu_vec.end())
cout<<"没有此人";
break;
case 3:OutputStu(stu_vec);break;
default:break;
}
}while(choice);
return 0;
}
void menu()
{
cout<<"1.录入信息"<<endl;
cout<<"2.查询信息"<<endl;
cout<<"3.浏览信息"<<endl;
cout<<"0.退出"<<endl;
}
void OutputStu( vector<Student>& stu_vec)
{
int count=0;
vector<Student>::const_iterator p;
for(p=stu_vec.begin();p!=stu_vec.end();p++)
{
(*p).Dispaly();
cout++;
}
cout<<"学生总人数"<<count<<endl;
}
void InputStu( vector<Student>& stu_vec)
{
char ch;
Student x;
do
{
x.Input();
stu_vec.push_back(x);
cout<<"继续输入?(Y/N)"<<endl;
cin.get();
cin.get(ch);
}while(ch=='Y');
}
他出现的错误是40 11 C:\Users\77461\Desktop\新建文件夹\未命名3.cpp [Error] jump to case label [-fpermissive]
28 31 C:\Users\77461\Desktop\新建文件夹\未命名3.cpp [Error] crosses initialization of 'std::vector<Student>::iterator p'
42 3 C:\Users\77461\Desktop\新建文件夹\未命名3.cpp [Error] jump to case label [-fpermissive]
28 31 C:\Users\77461\Desktop\新建文件夹\未命名3.cpp [Error] crosses initialization of 'std::vector<Student>::iterator p'
60 8 C:\Users\77461\Desktop\新建文件夹\未命名3.cpp [Error] 'const class Student' has no member named 'Dispaly'
61 7 C:\Users\77461\Desktop\新建文件夹\未命名3.cpp [Error] no 'operator++(int)' declared for postfix '++' [-fpermissive]