Esempio n. 1
0
int main () {
	Student stud(101, 78.5);
	Student * p = &stud;
	p->display();
	p->change(101, 80.5);
	p->display();

	return 0;
}
Esempio n. 2
0
int main(int argc, const char *argv[])
{
    Student stud1(1001,"Li",87);
    Graduate grad1(2001,"Wang",98.5,560);
    Student *pt = &stud1;
    pt->display();
    pt = &grad1;
    pt->display();
    return 0;
}
Esempio n. 3
0
int main()
{
    Student stud1(1001,"Li",87.5);
    Graduate grad1(2001,"Wang",98.7,343);
    Student *pt = &stud1;
    pt->display();
    pt = &grad1;
    pt->display();
    return 0;
}
Esempio n. 4
0
int main(void)
{
	Student *student = new Student("XiaoMing", 12, 99);
	student->display();
	Person *p = (Person *)student;
	p->display();
	delete student;

	Person *person = new Person("XiaoHua", 11);
	person->display();
	Student *s = (Student *)person;
	s->display();
	delete person;

	return 0;
}
Esempio n. 5
0
int main()
{
	Student s;
	//if we uncomment the below statement after compiling will give erro that method is inaccessible
//	s.read_data("regis",2)
s.set_data("our lady of good counsel high school",216478,"regis charles",22);
	s.display();
	
}
Esempio n. 6
0
int main()
{
    Person stu("hello", 1);
    stu.display();

    Student stt;
    stt.display();

    return 0;
}
Esempio n. 7
0
int main (int argc, char * const argv[]) {
	Name name;
	Student student;
	
	cin >> student;
	
	student.display(cout);
	
    return 0;
}
Esempio n. 8
0
int main(void)
{
	Student s(20, 100, "XiaoWang");
	s.display();

	Student *ps = new Student(16, "xiaowang", 100);
	ps->display();
	delete ps;

	return 0;
}
Esempio n. 9
0
int main() {
	string firstName, lastName;
	int score, phone;
	cin >> firstName;
	cin >> lastName;
	cin >> phone;
	cin >> score;
	Student *stu = new Grade(firstName, lastName, phone, score);
	stu->display();
	Grade *g = (Grade*)stu;
	cout << "\nGrade: " << g->calculate();
	return 0;
}
Esempio n. 10
0
int main()
{
  ofstream data;
  data.open("Student.dat",ios::out|ios::binary);

  char name[20], id[10], department[20], address[20];
  char ans;

  do
  {
    cout << "Enter Student information" << endl;
    cout << "Name: ";
    cin >> name;
    cout << "Id: " ;
    cin >> id;
    cout << "Department: " ;
    cin >> department;
    cout << "Address: " ;
    cin >> address;

    Student newStudent(name,id,department,address);

    data.write(reinterpret_cast<char *>(&newStudent),sizeof(newStudent));
    cout << "Do you want to continue adding student data y/n";
    cin >> ans;
  }
  while(ans == 'y');
  data.close();
 
  ifstream info;
  info.open("Student.dat",ios::in|ios::binary);
  while(!info.eof()) 
  {
    Student newStudent;
    info.read(reinterpret_cast<char *>(&newStudent),sizeof(newStudent));
    if (info)
      newStudent.display();
  }
  info.close();
  
  return SUCCESS;
}
//#endif
int main()
{   Cohort	cohort;
    ifstream	infile;
    infile.open("a5.txt");	// student names and marks
    assert (! infile.fail());
    int	m, c, s;
    string	nm;
    while(infile >> m >> c >> s)
    {   getline(infile, nm);	// Names have embedded spaces
        nm = nm.substr(3);	// Skip leading spaces
        Student	st(nm, m, c, s);
        cohort.insert(st);
    }
    ifstream queryfile;
    queryfile.open("queries.txt");	// names to look for
    assert (! queryfile.fail());
    string query;
    while(getline(queryfile, query))
    {   Student	st = cohort.find(query);
        if (st.getname().length() > 0)
            st.display();
        else	cout << query << " not there" << endl;
    }
}
Esempio n. 12
0
int main()
{	
	Student stud;
	stud.display();
	return 0;
}
Esempio n. 13
0
int main(){
  Student stud; 
  stud.set_value();
  stud.display();
  return 0;
}
Esempio n. 14
0
void fun(Student &s){
	s.display();
	s.change(120,98.5);
	s.display();
};