need help on my c++ code    i dont know how to properly use " tokennize "     #include #include #include #include "Date.h" #include "Person.h" #include "Student.h" #include "Faculty.h"   using namespace std; void addStudent(vector& students); void addFaculty(vector& faculty); void ListCourse(string fName, vectorstudents, vectorfaculty); void tokenizeDate(char* cDate, int& month, int& day, int& year); char menu();   int main()   {     //vectors for storage     vectorstudents;     vectorfaculty;     string courseName;       //name of course     cout << "Enter a name for your course: ";     getline(cin, courseName);     cout << endl;          // getmenu     char ch = menu();          //Loop repeat until quit     while (ch !='Q')     {         if (ch=='I'){             addFaculty (faculty);         }         else if (ch =='S'){             addStudent(students);         }         else if (ch=='L'){             ListCourse(courseName, students, faculty);         }         // loop repetition         cout<>ch;     return toupper(ch);      }   void addStudent() //example function that uses tokenizeDate     {     Date m, d, y;     char charDate[20]; //holds the date the user entered in char array     int pID;     Date bDate;     Date sEnrolled;     string fName, lName, sMajor, sLevel;     double sGPA;          Date realDate;  //date object; holds date after tokenization     cout << "\nEnter a date (mm/dd/yyyy):  ";         cin >> charDate;       cout<<"ID\n:";     cin>>pID;     cout<<"\nFirst Name:";     cin>>fName;     cout<<"\nLast Name:";     cin>>lName;     cout<<"\nMajor:";     cin>>sMajor;     cout<<"\nLevel (Freshman, Sophmore, Junior, Senior):";     cin>>sLevel;     cout<<"\nGPA:";     cin>>sGPA;          }              tokenizeDate(Date, m, d, y);         Date.setDate(m,d, y); }                //Split date into day,month and date         void tokenizeDate(char* cDate, int& month, int& day, int& year)     {             char seps[] = "/";             char* token = NULL;             char* next_token = NULL;               token = NULL;             next_token = NULL;                          // Establish string and get the tokens:                 token = strtok_s(cDate, seps, &next_token);                 month = atoi(token);                 token = strtok_s(NULL, seps, &next_token);                 day = atoi(token);                 token = strtok_s(NULL, seps, &next_token);                 year = atoi(token);             }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

I need help on my c++ code 

 

i dont know how to properly use " tokennize "

 

 

#include <iostream>

#include <vector>

#include <algorithm>

#include "Date.h"

#include "Person.h"

#include "Student.h"

#include "Faculty.h"

 

using namespace std;

void addStudent(vector<Student>& students);

void addFaculty(vector<Faculty>& faculty);

void ListCourse(string fName, vector<Student>students, vector<Faculty>faculty);

void tokenizeDate(char* cDate, int& month, int& day, int& year);

char menu();

 

int main()

 

{

    //vectors for storage

    vector<Student>students;

    vector<Faculty>faculty;

    string courseName;

 

    //name of course

    cout << "Enter a name for your course: ";

    getline(cin, courseName);

    cout << endl;

    

    // getmenu

    char ch = menu();

    

    //Loop repeat until quit

    while (ch !='Q')

    {

        if (ch=='I'){

            addFaculty (faculty);

        }

        else if (ch =='S'){

            addStudent(students);

        }

        else if (ch=='L'){

            ListCourse(courseName, students, faculty);

        }

        // loop repetition

        cout<<endl;

        ch = menu();

    }

    return 0;

}

 

//display choices and return choice

char menu()

{

        char ch;

                cout << "  Main Menu  " << endl;

                cout << "I -- Add Instructor" << endl;

                cout << "S -- Add Student" << endl;

                cout << "L -- List Course Information" << endl;

                cout << "Q -- Quit\n\n" << endl;

                cout << "Selection: ";

        cin>>ch;

    return toupper(ch);

    

}

 

void addStudent() //example function that uses tokenizeDate

    {

    Date m, d, y;

    char charDate[20]; //holds the date the user entered in char array

    int pID;

    Date bDate;

    Date sEnrolled;

    string fName, lName, sMajor, sLevel;

    double sGPA;

    

    Date realDate;  //date object; holds date after tokenization

    cout << "\nEnter a date (mm/dd/yyyy):  ";

        cin >> charDate;

 

    cout<<"ID\n:";

    cin>>pID;

    cout<<"\nFirst Name:";

    cin>>fName;

    cout<<"\nLast Name:";

    cin>>lName;

    cout<<"\nMajor:";

    cin>>sMajor;

    cout<<"\nLevel (Freshman, Sophmore, Junior, Senior):";

    cin>>sLevel;

    cout<<"\nGPA:";

    cin>>sGPA;

    

    }

    

        tokenizeDate(Date, m, d, y);

        Date.setDate(m,d, y);

}

 

        

    //Split date into day,month and date

        void tokenizeDate(char* cDate, int& month, int& day, int& year)

    {

            char seps[] = "/";

            char* token = NULL;

            char* next_token = NULL;

 

            token = NULL;

            next_token = NULL;

            

            // Establish string and get the tokens:

                token = strtok_s(cDate, seps, &next_token);

                month = atoi(token);

                token = strtok_s(NULL, seps, &next_token);

                day = atoi(token);

                token = strtok_s(NULL, seps, &next_token);

                year = atoi(token);

            }

Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY