954,483 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Make a project, consisting of 3 modules: student.cpp, course.cpp and register.cpp.

Make a project, consisting of 3 modules: student.cpp, course.cpp and register.cpp. Write source and header file for a program that registers students for courses. Design a class student that stores the name of the student, the id number and array (vector) of all course numbers for which the student is resisted. Design a class course that stores the course number, and array (vector) of the id numbers of all students who are registered for this course. In the register.cpp implement functions that add and drop students and print course lists.

I got this far somebody help me with the rest of the program please. help me guys i really need ur help..

#include <iostream>
#include <string>
#include <vector>
using namespace std;

class student
{
public:
      student();
      void addCourse (int courseNumber);
      void dropCourse (int courseNumber);
     void print();
     friend class course;

private:
     int studentID;
    string studentName;
   vector<int> courseID;
};

void student:: addCourse (int courseNumber)
{
      courseId.push_back  (courseNumber);
}
void student::dropCourse (int courseNumber)
{
      for (int i = 0; i < courseID.size(); i++)
      {
             if (courseId[i] == courseNumber)
             {
                     int temp = courseID[i];
                     courseId [i] = courseID [courseID>size()-1];
                     courseId [courseID.size()-1] = temp;
                     courseID.pop_back();
               }
         }
}

void student::print()
{
        cout << name << studentID <<endl;
        for (int i = 0; i < courseID.size(); i++)
        {
               cout << courseID[i] <<endl;
         }
}

void main()
{
       student student_1 ("Yuja",20);
       course course_1 ("CISP",34);
       student_ .addCourse(course);
}


void main()
{
    student one("student1",1);
    student two("student2",2);
    course c_one("math",101);
    course c_two("cis",202);
    vector<student>s;
    vector<course>c;
    s.push_bacl(one);
    s.push_back(two);
    c.push_back(c_one);
    c.push_back(c_two);
    .
        .
        .
    cout<<"1.Add course"<<endl;
    .
        .
        .
        .
        if(choice==1)
        {
            cout<<"Enter student id";
            int s_id;
            cin>>s_id;
            for(int i=0; i<s.size(); i++)
            {
                if(s_id==s[i]_id())//you will have to add id
                {
                    cout<<"Enter course id"<<endl;
                        int c_id;
                    cin>>c_id;
                        for(int j=0; j<c.size(); j++)
                        {
                            if(c_id==c[j].get_id())
                            {
                                s[i].add_course(c[j].get_id());
                                c[j].add_student(s_id);
                            }
                        }
                }
brain007
Newbie Poster
3 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
 

guys help me please..............

brain007
Newbie Poster
3 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
 

It's barely been 10-mins. You can't expect immediate answers. Especially when you triple post. Good Luck.

Fbody
Posting Maven
2,930 posts since Oct 2009
Reputation Points: 833
Solved Threads: 393
 

And since it's only been 15 minutes since your post, you still have time to edit your post to add code tags and reformat your code so we can read it.

Also, you need to tell us what you're actually having trouble with. No one is just going to finish your program for you.

Sodabread
Posting Whiz in Training
290 posts since Nov 2009
Reputation Points: 103
Solved Threads: 42
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: