#include <iostream>
#include <vector>
#include <string>
#include <fstream>
#include <sstream>
#include <windows.h>
using namespace std;

class Subject
{
    protected:
    string sub_code;
    string sub_fac;

    public:
    Subject(string sub_code="", string sub_fac="")
    {
        this->sub_code = sub_code;
        this->sub_fac = sub_fac;
    }
    string getSubCode() {return sub_code;}
    string getSubFac() {return sub_fac;}

};

class Student
{
    protected:
    string stud_name;
    string stud_fac;

    public:
    Student(string stud_name="", string stud_fac="")
    {
        this->stud_name = stud_name;
        this->stud_fac = stud_fac;
    }
    string getStudName() {return stud_name;}
    string getStudFac() {return stud_fac;}
};

vector <Subject> subject;
vector <Student> student;
string temp1, temp2;
bool stud_exist=0, sub_exist=0, duplicate=0;
int position;

class Registration : public Subject, public Student
{
    public:
    Registration(string stud_name, string stud_fac, string sub_code, string sub_fac) : Student(stud_name,stud_fac), Subject(sub_code,sub_fac) {}
};

vector <Registration> registration;

void Import(char filename[]);
void Combine(string student_name, string subject_name);
void ListAll(string input);
void ListOne(string input);
void Add(string input);
void Delete(string input);
void RegistrationFunction(string input);
void Check();
string Upper(string input);

void End()
{
    cout << endl << endl;
    system("pause");
}

void ShowMessage(int msgcode=0)
{
    if (msgcode == 0)
        cout << "\nNULL value is found";
    else if (msgcode == 1)
        cout << endl << "Student " << temp1 << " cannot be found";
    else if (msgcode == 2)
        cout << endl << "Subject " << temp2 << " cannot be found";
    else if (msgcode == 3)
        cout << endl << "Subject " << temp1 << " cannot be found";
    else if (msgcode == 4)
        cout << endl << temp1 << " has been added previously";
    else if (msgcode == 5)
        cout << endl << temp1 << " has registered " << temp2 << " previously";
    else if (msgcode == 6)
        cout << endl << temp1 << " has not register the subject " << temp2 << " previously";
    else if (msgcode == 96)
        cout << endl << temp1 << " has dropped " << temp2 << " successfully";
    else if (msgcode == 97)
        cout << endl << temp1 << " has registered " << temp2 << " successfully";
    else if (msgcode == 98)
        cout << endl << temp1 << " has been removed permanently";
    else if (msgcode == 99)
        cout << endl << temp1 << " has been registered under the faculty " << temp2 << " successfully";

    if (msgcode<50)
        system("color 04");
    else
        system("color 02");
}

int main()
{
    int x;

    Import("subjects.txt");
    Import("students.txt");
    Import("registration.txt");

    while(1)
    {
        temp1 = " "; // Clear data
        temp2 = " "; // Clear data
        system("color 07");
        system("cls");
        cout << "Subject Registration System\n\n"
                "1.\tCreate a student\n"
                "2.\tCreate a subject\n"
                "3.\tDelete a student\n"
                "4.\tDelete a subject\n"
                "5.\tRegister a student to/from a subject\n"
                "6.\tDrop a student to/from a subject\n"
                "7.\tList all students\n"
                "8.\tList all subjects\n"
                "9.\tList subjects of a specified student\n"
                "10.\tList students of a specified subject\n\n"
                "Choose one: ";
        cin >> x;
        cin.clear();
        cin.ignore(255,'\n');
        switch(x)
        {
            case 1: {Add("Student"); break;}
            case 2: {Add("Subject"); break;}
            case 3: {Delete("Student"); break;}
            case 4: {Delete("Subject"); break;}
            case 5: {RegistrationFunction("Add"); break;}
            case 6: {RegistrationFunction("Drop"); break;}
            case 7: {ListAll("Student"); break;}
            case 8: {ListAll("Subject"); break;}
            case 9: {ListOne("Student"); break;}
            case 10: {ListOne("Subject"); break;}
        }
    }

}

void Import(char filename[])
{
    vector<string>temp;
    ifstream in; string data;

    in.open(filename);

    while (getline(in,data,'\n')) // Store the data line by line
        temp.push_back(data);

    for (int i=0; i<temp.size(); i++)
    {
        int count=0; string str = temp[i];
        stringstream stream(str);

        while(getline(stream, data, ',')) // Seperate data by comma
        {
            if(count==0)
                temp1 = data;
            else if (count==1)
                temp2 = data;

            count++;
        }

        if(filename=="subjects.txt")
        {
            Subject x(temp1, temp2);
            subject.push_back(x);
            Combine("",temp1);
        }
        else if(filename=="students.txt")
        {
            Student x(temp1, temp2);
            student.push_back(x);
            Combine(temp1,"");
        }
        else if(filename=="registration.txt")
            Combine(temp1,temp2);
    }

    temp.clear();
    in.clear();
    in.close();
}

void Combine(string x, string y)
{
    int flag=0; string a,b,c,d;

    for(int i=0; i<student.size();i++) // Fetch student's faculty
    if(Upper(student[i].getStudName())==Upper(x))
    {
        a = student[i].getStudName();
        b = student[i].getStudFac();
    }

    for(int i=0; i<subject.size();i++) // Fetch subject's faculty
    if(Upper(subject[i].getSubCode())==Upper(y))
    {
        c = subject[i].getSubCode();
        d = subject[i].getSubFac();
    }

    Registration temp(a,b,c,d); // Confirm registration
    registration.push_back(temp);
}

void ListOne(string x)
{
    system("cls");
    int count = 1;
    if (x=="Student")
        cout << "You are about to list all subjects from a Student\n\nStudent Name\t: ";
    else if (x=="Subject")
        cout << "You are about to list all students from a Subject\n\nSubject Code\t: ";
    getline(cin,temp1);

    Check();

    if(temp1=="")
        ShowMessage(0); // Display Message
    else if(stud_exist == 0 && x=="Student")
        ShowMessage(1); // Display Message
    else if(sub_exist == 0 && x=="Subject")
        ShowMessage(3); // Display Message

    else
    {
        for (int i=0; i<registration.size(); i++)
        if(Upper(registration[i].getStudName()) == Upper(temp1) && registration[i].getSubCode()!= "" && x=="Student")
        {
            if (count==1)
            cout << "\nNo.\tSubjects\tFaculty\n";
            cout << count << "\t" <<  registration[i].getSubCode() << "\t\t" << registration[i].getSubFac() << "\n";
            count++;
        }
        else if(Upper(registration[i].getSubCode()) == Upper(temp1) && registration[i].getStudName()!= "" && x=="Subject")
        {
            if (count==1)
            cout << "\nNo.\tStudents\tFaculty\n";
            cout << count << "\t" <<  registration[i].getStudName() << "\t\t" << registration[i].getStudFac() << "\n";
            count++;
        }
    }

    End();
}

void ListAll(string x)
{
    system("cls");
    vector<Registration>temp = registration;

    if(x=="Subject")
        cout << "All subjects\n\nNo.\tSubjects\tFaculty\t\tStudents\n";
    else if(x=="Student")
        cout << "All students\n\nNo.\tStudents\tFaculty\t\tSubjects\n";


    for (int i=0; i<temp.size(); i++)
    {
        bool comma=0;
        if(temp[i].getSubCode()=="" && x=="Subject") // Make sure subject is not empty
        {temp.erase(temp.begin()+i); i--;}
        else if(temp[i].getStudName()=="" && x=="Student") // Make sure subject is not empty
        {temp.erase(temp.begin()+i); i--;}
        else
        {
            if(x=="Subject") // Publish all subjects
            {
                cout << i+1 << "\t" <<  temp[i].getSubCode() << "\t\t" << temp[i].getSubFac() << "\t\t";

                for (int j=temp.size()-1; j>=0; j--)
                if(Upper(temp[j].getSubCode())==Upper(temp[i].getSubCode()) && temp[j].getStudName() != "")
                {
                    if(comma)
                    cout << ", ";
                    cout << temp[j].getStudName();
                    if(i!=j) {temp.erase(temp.begin()+j);}
                    comma = 1;
                }
                cout << endl;
            }
            else if(x=="Student") // Publish all students
            {
                cout << i+1 << "\t" <<  temp[i].getStudName() << "\t\t" << temp[i].getStudFac() << "\t\t";

                for (int j=temp.size()-1; j>=0; j--)
                if(Upper(temp[j].getStudName())==Upper(temp[i].getStudName()) && temp[j].getSubCode() != "")
                {
                    if(comma)
                    cout << ", ";
                    cout << temp[j].getSubCode();
                    if(i!=j) {temp.erase(temp.begin()+j);}
                    comma = 1;
                }
                cout << endl;
            }
        }
    }

    End();
}

void Add(string x)
{
    system("cls");

    if(x=="Student")
        cout << "You are about to add a new student\n\nStudent Name\t: ";
    else if(x=="Subject")
        cout << "You are about to add a new subject\n\nSubject Code\t: ";
    getline(cin,temp1);
    cout << "Faculty Name\t: ";
    getline(cin,temp2);

    Check();

    if(temp1=="" || temp2=="")
        ShowMessage(0); // Display Message
    else if(stud_exist || sub_exist)
        ShowMessage(4); // Display Message
    else if(x=="Student")
    {
        Student temp(temp1, temp2);
        student.push_back(temp);
        Combine(temp1,"");
        ShowMessage(99); // Display Message
    }
    else if(x=="Subject")
    {
        Subject temp(temp1, temp2);
        subject.push_back(temp);
        Combine("",temp1);
        ShowMessage(99); // Display Message
    }
    End();
}

void Delete(string x)
{
    system("cls");
    bool flag=0;

    cout << "You are about to delete a " << x << "\n\n" << x << " Name\t: ";
    getline(cin,temp1);

    for (int i=0; i<registration.size(); i++)
    if ((Upper(registration[i].getStudName())==Upper(temp1) && x=="Student") || (Upper(registration[i].getSubCode())==Upper(temp1) && x=="Subject"))
    {
        registration.erase(registration.begin()+i);
        flag = 1;
        i--;
    }

    if(temp1=="")
        ShowMessage(0); // Display Message
    else if (flag == 1)
        ShowMessage(98); // Display Message
    else
        ShowMessage(1); // Display Message

    End();
}

void RegistrationFunction(string x)
{
    system("cls");

    if (x=="Add")
    cout << "You are about to register a subject to a student\n\nStudent Name\t: ";
    else if (x=="Drop")
    cout << "You are about to drop a subject from a student\n\nStudent Name\t: ";
    getline(cin,temp1);
    cout << "Subject Code\t: ";
    getline(cin,temp2);

    Check();

    if(temp1=="" || temp2=="")
        ShowMessage(0); // Display Message
    else if (duplicate==1 && x=="Add")
        ShowMessage(5); // Display Message
    else if(stud_exist==1 && sub_exist==1 && x=="Add")
    {
        Combine(temp1,temp2); // Perform registration
        ShowMessage(97); // Display Message
    }
    else if (duplicate==0)
        ShowMessage(6); // Display Message
    else if(duplicate==1 && x=="Drop")
    {
        registration.erase(registration.begin()+position); // Perform deletion
        ShowMessage(96); // Display Message
    }

    if (stud_exist==0)
        ShowMessage(1); // Display Message

    if (sub_exist==0)
        ShowMessage(2); // Display Message

    End();
}

void Check()
{
    stud_exist = 0; sub_exist = 0; duplicate = 0;

    for (int i=0; i<registration.size(); i++)
    {
        if (Upper(registration[i].getStudName())==Upper(temp1)) // Check if student exist
            stud_exist = 1;
        else if(Upper(registration[i].getSubCode())==Upper(temp1) || Upper(registration[i].getSubCode())==Upper(temp2)) // Check if subject exist
            sub_exist = 1;

        if (Upper(registration[i].getStudName())==Upper(temp1) && Upper(registration[i].getSubCode())==Upper(temp2)) // Check for duplication
        {duplicate = 1; position = i;}
    }
}

string Upper(string x)
{
    for (int i=0; i<x.size(); i++)
    x[i] = toupper(x[i]);

    return x;
}

im having trouble with too few argument at the void combine... and also at the part void add which precisely at combine(temp,""). Please help me....this is the final i need to wrap my project

Recommended Answers

All 10 Replies

at the void combine

437 lines and you can't be more specific than that?

also at the part void add which precisely at combine(temp,"")

Meaning what? and where?

If you notice there are line numbers in your post. They might be useful.

Line 195 and line 336....sorry didnt put the linenum

Line 195 - I don't see anything wrong with that definition of combine()
line 336 looks fine too.

Sounds like you'll have to supply more detailed information so we have a complete understanding of the problem.

#include <iostream>
#include <vector>
#include <string>
#include <fstream>
#include <sstream>
#include <windows.h>
using namespace std;

class Lecturer
{
    protected:
    string lec_name;
    string lec_id;
    string lec_fac;

    public:
    Lecturer(string lec_name="", string lec_id="",string lec_fac="")
    {
        this->lec_name = lec_name;
        this->lec_id = lec_id;
        this->lec_fac = lec_fac;
    }
    string getLecName() {return lec_name;}
    string getLecId() {return lec_id;}
    string getLecFac() {return lec_fac;}

};

class Student
{
    protected:
    string stud_name;
    string stud_id;
    string stud_fac;

    public:
    Student(string stud_name="", string stud_id="",string stud_fac="")
    {
        this->stud_name = stud_name;
        this->stud_id = stud_id;
        this->stud_fac = stud_fac;
    }
    string getStudName() {return stud_name;}
    string getStudId() {return stud_id;}
    string getStudFac() {return stud_fac;}
};

class Project
{
    protected:
    string proj_name;
    string proj_id;

    public:
    Project(string proj_name="", string proj_id="")
    {
        this->proj_name = proj_name;
        this->proj_id = proj_id;
    }
    string getProjName() {return proj_name;}
    string getProjId() {return proj_id;}
};

vector <Lecturer> lecturer;
vector <Student> student;
vector <Project> project;
string temp1, temp2, temp3;
bool lec_exist=0, stud_exist=0, proj_exist=0, duplicate=0;
int position;

class Record : public Lecturer, public Student, public Project
{
    public:
    Record(string lec_name, string lec_fac,string lec_id,string stud_name, string stud_id,string stud_fac,string proj_name,string proj_id)
    : Lecturer(lec_name,lec_id,lec_fac), Student(stud_name,stud_id,stud_fac), Project(proj_name,proj_id) {}
};

vector <Record> record;

void Combine(string lecturer_name, string student_name, string project_name);
void ListAll(string input);
void ListOne(string input);
void Add(string input);
void Delete(string input);
void RecordFunction(string input);
void Check();
void Import(char filename[]);
string Upper(string input);

void End()
{
    cout << endl << endl;
    system("pause");
}

void ShowMessage(int msgcode=0)
{
    if (msgcode == 0)
        cout << "\nNULL value is found";
    else if (msgcode == 1)
        cout << endl << "Lecturer " << temp1 << "not in the data";
    else if (msgcode == 2)
        cout << endl << "Student" << temp2 << " not in the data";
    else if (msgcode == 3)
        cout << endl << "Project " << temp3 << " not in the data";
    else if (msgcode == 4)
        cout << endl << "Lecturer " << temp1 << " cannot be found";
    else if (msgcode == 5)
        cout << endl << temp1 << " has been added previously";
    else if (msgcode == 6)
        cout << endl << temp1 << " has registered " << temp2 << " previously";
    else if (msgcode == 7)
        cout << endl << temp1 << " has not register the subject " << temp2 << " previously";
    else if (msgcode == 96)
        cout << endl << temp1 << " has dropped " << temp2 << " successfully";
    else if (msgcode == 97)
        cout << endl << temp1 << " has registered " << temp2 << " successfully";
    else if (msgcode == 98)
        cout << endl << temp1 << " has been removed permanently";
    else if (msgcode == 99)
        cout << endl << temp1 << " has been registered under the faculty " << temp2 << " successfully";

    if (msgcode<50)
        system("color 03");
    else
        system("color 08");
}

int main()
{
    int x;

    Import("lecturer.txt");
    Import("students.txt");
    Import("project.txt");

    while(1)
    {
        temp1 = " "; // Clear data
        temp2 = " "; // Clear data
        system("color 09");
        system("cls");
        cout << "\t\t_______________________________________________\n"
                "\t\t**Final Year Project Management System**\n"
                "\t\t_______________________________________________\n"
                "\t\t| 1  |\tCreate a lecturer                      |\n "
                "\t\t| 2  |\tCreate a student                       |\n"
                "\t\t| 3  |\tCreate a project                       |\n"
                "\t\t| 4  |\tDelete a lecturer                      |\n"
                "\t\t| 5  |\tDelete a student                       |\n"
                "\t\t| 6  |\tDelete a project                       |\n"
                "\t\t| 7  |\tRegister a student to/from a lecturer  |\n"
                "\t\t| 8  |\tDrop a student to/from a lecturer      |\n"
                "\t\t| 9  |\tList all lecturer                      |\n"
                "\t\t| 10 |\tList all students                      |\n"
                "\t\t| 11 |\tList all projects                      |\n"
                "\t\t| 12 |\tList subjects of a specified student   |\n"
                "\t\t| 13 |\tList students of a specified subject   |\n"
                "\t\t________________________________________________\n\n"
                "Choose one: ";

        cin >> x;
        cin.clear();
        cin.ignore(255,'\n');

        switch(x)
        {
            case 1: {Add("Lecturer"); break;}
            case 2: {Add("Student"); break;}
            case 3: {Add("Project"); break;}
            case 4: {Delete("Lecturer"); break;}
            case 5: {Delete("Student"); break;}
            case 6: {Delete("Project"); break;}
            case 7: {RecordFunction("Add"); break;}
            case 8: {RecordFunction("Drop"); break;}
            case 9: {ListAll("Lecturer"); break;}
            case 10: {ListAll("Student"); break;}
            case 11: {ListAll("Project"); break;}
            case 12: {ListOne("Lecturer"); break;}
            case 13: {ListOne("Student"); break;}
            case 14: {ListOne("Project"); break;}
        }
    }

}

void Combine(string x, string y, string z)
{
    int flag=0;
    string a,b,c,d,e,f,g,h;

    for(int i=0; i<lecturer.size();i++) // Fetch lecturer's faculty
    if(Upper(lecturer[i].getLecName())==Upper(x))
    {
        a = lecturer[i].getLecName();
        b = lecturer[i].getLecId();
        c = lecturer[i].getLecFac();
    }

    for(int i=0; i<student.size();i++) // Fetch student's faculty
    if(Upper(student[i].getStudName())==Upper(y))
    {
        d = student[i].getStudName();
        e = student[i].getStudId();
        f = student[i].getStudFac();
    }

    for(int i=0; i<project.size();i++) // Fetch project's faculty
    if(Upper(project[i].getProjName())==Upper(z))
    {
        g = project[i].getProjName();
        h = project[i].getProjId();
    }

    Record temp(a,b,c,d,e,f,g,h); // Confirm registration
    record.push_back(temp);
}

void ListOne(string x)
{
    system("cls");
    int count = 1;
    if (x=="Lecturer")
        cout << "You are about to list all Lecturer\n\nLecturer Name\t: ";\
    else if (x=="Students")
        cout << "You are about to list all students \n\nStudent Id\t: ";
    else if (x=="Projects")
        cout << "You are about to list all projects \n\nProject Id\t: ";
    getline(cin,temp1);
    getline(cin,temp2);
    getline(cin,temp3);

    Check();

    if(temp1=="")
        ShowMessage(0); // Display Message
    else if(lec_exist == 0 && x=="Lecturer")
        ShowMessage(1); // Display Message
    else if(stud_exist == 0 && x=="Student")
        ShowMessage(4); // Display Message
    else if(stud_exist == 0 && x=="Project")
        ShowMessage(4); // Display Message
    else
    {
        for (int i=0; i<record.size(); i++)
        if(Upper(record[i].getLecName()) == Upper(temp1) && record[i].getStudName()!= "" && record[i].getProjName()!= "" && x=="Lecturer")
        {
            if (count==1)
            cout << "\nNo.\tStudent Name\tStudent ID\tProject Name\tProject ID\n";
            cout << count << "\t" <<  record[i].getStudName() << "\t\t" << record[i].getStudId()<< "\t\t" << record[i].getStudFac()<< "\t\t" << record[i].getProjName()<< "\t\t" << record[i].getProjId()<< "\n";
            count++;
        }
        else if(Upper(record[i].getStudName()) == Upper(temp1) && record[i].getLecName()!= "" &&record[i].getProjName()!= "" && x=="Student")
        {
            if (count==1)
            cout << "\nNo.\tLecturers\tLecturerID\tLecturer Faculty\tProject Name\tProject IID\n";
            cout << count << "\t" <<  record[i].getLecName() << "\t\t" << record[i].getLecId()<< "\t\t" << record[i].getLecFac()<< "\t\t"<< record[i].getLecFac() << "\t\t" << record[i].getProjName()<< "\t\t" << record[i].getProjId()<< "\n";
            count++;
        }
        else if(Upper(record[i].getProjName()) == Upper(temp1) && record[i].getLecName()!= ""&& record[i].getStudName()!= ""&& x=="Student")
        {
            if (count==1)
            cout << "\nNo.\tLecturer Name\tLecturer ID\nLecturer Fac\nStudent Name\nStudent ID\nStudent Fac";
            cout << count << "\t" <<  record[i].getLecName() << "\t\t" << record[i].getLecId()<< "\t\t" << record[i].getLecFac()<< "\t\t" <<  record[i].getStudName()
            << "\t\t" << record[i].getStudId()<< "\t\t" << record[i].getStudFac() << "\n";
            count++;
        }
    }

    End();
}

void ListAll(string x)
{
    system("cls");
    vector<Record>temp = record;

    if(x=="Lecturers")
        cout << "All lecturers\n\nNo.\tLecturers\tID\t\tFaculty\t\tStudent\t\tProject\n";
    else if(x=="Student")
        cout << "All students\n\nNo.\tStudents\tID\tFaculty\t\tLecturer\t\tProject\n";
    else if(x=="Project")
        cout << "All project\n\nNo.\tProjects\tID\t\t\tLecturer\t\tStudent\n";


    for (int i=0; i<temp.size(); i++)
    {
        bool comma=0;
        if(temp[i].getLecName()=="" && x=="Lecturer") // Make sure lecturer is not empty
        {temp.erase(temp.begin()+i); i--;}
        else if(temp[i].getStudId()=="" && x=="Student") // Make sure lecturer is not empty
        {temp.erase(temp.begin()+i); i--;}
        else if(temp[i].getProjId()=="" && x=="Project") // Make sure lecturer is not empty
        {temp.erase(temp.begin()+i); i--;}
        else
        {
            if(x=="Lecturer") // Publish all students and projects
            {
                cout << i+1 << "\t" <<  temp[i].getLecName() << "\t\t" << temp[i].getLecId() << "\t\t" << temp[i].getLecFac() << "\t\t";

                for (int j=temp.size()-1; j>=0; j--)
                if(Upper(temp[j].getLecName())==Upper(temp[i].getLecName()) && temp[j].getStudName() != "" && temp[j].getProjName() != "")
                {
                    if(comma)
                    cout << ", ";
                    cout << temp[j].getStudName();
                    if(i!=j) {temp.erase(temp.begin()+j);}
                    comma = 1;
                }
                cout << endl;
            }
            else if(x=="Student") // Publish all students
            {
                cout << i+1 << "\t" <<  temp[i].getStudName() << "\t\t" << temp[i].getStudId()<< "\t\t" << temp[i].getStudFac() << "\t\t";

                for (int j=temp.size()-1; j>=0; j--)
                if(Upper(temp[j].getStudName())==Upper(temp[i].getStudName()) && temp[j].getLecName() != "" && temp[j].getProjName() != "")
                {
                    if(comma)
                    cout << ", ";
                    cout << temp[j].getLecName();
                    if(i!=j) {temp.erase(temp.begin()+j);}
                    comma = 1;
                }
                cout << endl;
            }
            else if(x=="Project") // Publish all students
            {
                cout << i+1 << "\t" <<  temp[i].getProjName() << "\t\t" << temp[i].getProjId() << "\t\t";

                for (int j=temp.size()-1; j>=0; j--)
                if(Upper(temp[j].getProjName())==Upper(temp[i].getProjName()) && temp[j].getLecName() != "" && temp[j].getStudName() != "")
                {
                    if(comma)

                    cout << ", ";
                    cout << temp[j].getProjName();
                    if(i!=j) {temp.erase(temp.begin()+j);}
                    comma = 1;

                }
                cout << endl;
            }
        }
    }

    End();
}

void Add(string x)
{
    system("cls");

    if(x=="Lecturer")
        cout << "You are about to add a new lecturer\n\nLecturer Name\t: ";
    else if(x=="Student")
        cout << "You are about to add a new student\n\nSubject Name\t: ";
    else if(x=="Project")
        cout << "You are about to add a new project\n\nProject Name\t: ";
    getline(cin,temp1);
    cout << "ID\t: ";
    getline(cin,temp2);
    cout << "Faculty\t: ";
    getline(cin,temp3);

    Check();

    if(temp1=="" || temp2=="" || temp3=="")
        ShowMessage(0); // Display Message
    else if(lec_exist || stud_exist || proj_exist)
        ShowMessage(5); // Display Message
    else if(x=="Lecturer")
    {
        Lecturer temp(temp1, temp2,temp3);
        lecturer.push_back(temp);
        Combine(temp1,"");
        ShowMessage(99); // Display Message
    }
    else if(x=="Student")
    {
        Student temp(temp1,temp2,temp3);
        student.push_back(temp);
        Combine("",temp1);
        ShowMessage(99);// Display Message
    }
    else if(x=="Project")
    {
        Project temp(temp1,temp2);
        project.push_back(temp);
        Combine(temp1,"");
        ShowMessage(99); // Display Message
    }
    End();
}

void Delete(string x)
{
    system("cls");
    bool flag=0;

    cout << "You are about to delete a " << x << "\n\n" << x << " Name\t: ";
    getline(cin,temp1);

    for (int i=0; i<record.size(); i++)
    if ((Upper(record[i].getLecName())==Upper(temp1) && x=="Lecturer") || (Upper(record[i].getStudName())==Upper(temp1) && x=="Student")|| (Upper(record[i].getProjName())==Upper(temp1) && x=="Project"))
    {
        record.erase(record.begin()+i);
        flag = 1;
        i--;
    }

    if(temp1=="")
        ShowMessage(0); // Display Message
    else if (flag == 1)
        ShowMessage(98); // Display Message
    else
        ShowMessage(1); // Display Message

    End();
}

void RecordFunction(string x)
{
    system("cls");

    if (x=="Add")
    cout << "You are about to register a student to a lecturer\n\nStudent Name\t: ";
    else if (x=="Drop")
    cout << "You are about to drop a student from a lecturer\n\nStudent Name\t: ";
    getline(cin,temp1);
    cout << "Student ID\t: ";
    getline(cin,temp2);

    Check();

    if(temp1=="" || temp2=="" || temp3=="")
        ShowMessage(0); // Display Message
    else if (duplicate==1 && x=="Add")
        ShowMessage(6); // Display Message
    else if(lec_exist==1 && stud_exist==1 && proj_exist==1 && x=="Add")
    {
        Combine(temp1,temp2,temp3); // Perform registration
        ShowMessage(97); // Display Message
    }
    else if (duplicate==0)
        ShowMessage(6); // Display Message
    else if(duplicate==1 && x=="Drop")
    {
        record.erase(record.begin()+position); // Perform deletion
        ShowMessage(96); // Display Message
    }

    if (stud_exist==0)
        ShowMessage(1); // Display Message

    if (stud_exist==0)
        ShowMessage(2); // Display Message

    if (proj_exist==0)
        ShowMessage(3); // Display Message

    End();
}

void Check()
{
    lec_exist = 0; stud_exist = 0; proj_exist= 0; duplicate = 0;

    for (int i=0; i<record.size(); i++)
    {
        if (Upper(record[i].getLecName())==Upper(temp1)) // Check if student exist
            lec_exist = 1;
        else if(Upper(record[i].getStudName())==Upper(temp1) || Upper(record[i].getStudName())==Upper(temp2)) // Check if subject exist
            stud_exist = 1;
        else if(Upper(record[i].getProjName())==Upper(temp1) || Upper(record[i].getProjName())==Upper(temp2)) // Check if subject exist
            proj_exist = 1;

        if (Upper(record[i].getLecName())==Upper(temp1) && Upper(record[i].getStudName())== Upper(temp2) && Upper(record[i].getProjName())== Upper(temp3)); // Check for duplication
        {duplicate = 1; position = i;}
    }
}

void Import(char filename[])
{
    vector<string>temp;
    ifstream in; string data;

    in.open(filename);

    while (getline(in,data,'\n')) // Store the data line by line
        temp.push_back(data);

    for (int i=0; i<temp.size(); i++)
    {
        int count=0; string str = temp[i];
        stringstream stream(str);

        while(getline(stream, data, ',')) // Seperate data by comma
        {
            if(count==0)
                temp1 = data;
            else if (count==1)
                temp2 = data;

            count++;
        }

        if(filename=="lecturer.txt")
        {
            Lecturer x(temp1, temp2, temp3);
            lecturer.push_back(x);
            Combine("", temp1);
        }
        else if(filename=="students.txt")
        {
            Student x(temp1, temp2, temp3);
            student.push_back(x);
            Combine(temp1,"");
        }
        else if(filename=="projects.txt")
            Combine(temp1,temp2,temp3);
    }

    temp.clear();
    in.clear();
    in.close();
}

string Upper(string x)
{
    for (int i=0; i<x.size(); i++)
    x[i] = toupper(x[i]);

    return x;
}

this is the code which has the problem...

||In function 'int main()':|

||In function 'void Add(std::string)':|

|187|error: too few arguments to function 'void Combine(std::string, std::string, std::string)'|

|376|error: at this point in file|

|187|error: too few arguments to function 'void Combine(std::string, std::string, std::string)'|

|383|error: at this point in file|

|187|error: too few arguments to function 'void Combine(std::string, std::string, std::string)'|

|Emphasized Text Here390|*error: at this point in file|

||In function 'void Import(char*)':|

|512|error: at this point in file|
|518|error: at this point in file|
|521|error: at this point in file|

these are the errors i get....

Read the errors carefully. They tell you exactly what the problem is. What would "too few arguments" in a function call mean?

that means we use declared multiple parameter but sendind one only ryte....I just dun noe which one to change

See that, in Combine() method, you are passing two arguments, Combine(temp1,""); while it requires 3 arguments. If you want to avoid this, you can make another method of the same name, but different number of parameters, basically function overloading.

Neither do we. It's your code.

For the function void Combine() on 187:
-- how many parameters are specified?
-- are they all needed? If not, fix the definition. If so, fix the calls.

You may check this out, for function overloading.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.