hello,
i want to write a simple university programme
please first see my code
#include<iostream>
#include<string>
#include<vector>
using namespace std;
class subject
{
string code;
public:
void create_code();
void list_of_code();
};
class student
{
string name;
public:
void create_student();
void list_student();
};
int main()
{
int size_of_student,size_of_subject;
student student_attributes;
subject subject_attributes;
// creating new student first
vector<student>new_student;
cout <<"How many student do you want to create? ";
cin >> size_of_student;
for (int i = 0 ; i < size_of_student; i++)
{
student_attributes.create_student();
new_student.push_back(student_attributes);
// creating subjects
vector<subject>new_subject;
cout <<"How many subject do you want to create? ";
cin >> size_of_subject;
for (int i = 0 ; i < size_of_subject; i++)
{
subject_attributes.create_code();
new_subject.push_back(subject_attributes);
}
cout <<"You successfully created a student with "<<size_of_subject<<" subjects "<<endl;
}
return 0;
}
please notice that my code doesn't include the member function for the classes(late i'll include it but for now help for my questions)
now my questions is, is my way correct to get the student name and new subject by using vector?
another question, how to list all the student? or list all the subject? (cout of vector))
another question is how to liast all student for a specfic subject? can you please show me
thanks