Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- string name;
- int grade;
- vector<wilsonStudent::student> vectorOfStudents;
- wilsonStudent::student student1("John", 95);
- vectorOfStudents.push_back(student1);
- .... repeats several times for all data
- // create the HTML table object and set its members HTMLTable hTable;
- wilsonOutput::HTMLTable hTable;
- hTable.setRow(vectorOfStudents);
- .... other code
- return 0;
- }
- #ifndef OUTPUTTOHTML_H
- #define OUTPUTTOHTML_H
- namespace wilsonOutput
- {
- class HTMLTable
- {
- private:
- public:
- void setRow(vector<wilsonStudent::student> &vectorOfObjects);
- // Set headers for the table columns
- };
- }
- #endif
- void wilsonOutput::HTMLTable::setRow(vector<wilsonStudent::student> &vectorOfObjects)
- {
- int vectorSize = vectorOfObjects.size();
- for (unsigned int counter = 0; counter < vectorSize; counter++)
- {
- int grade = vectorOfObjects.getGrade();
- string name = vectorOfObjects.getName();
- std::stringstream out;
- out << grade;
- string gradeString = out.str();
- string arrayOfStudentInformation[] = {name, gradeString, ""};
- addRow(StringVector(arrayOfStudentInformation));
- }
- }
- int grade = vectorOfObjects.getGrade();
- string name = vectorOfObjects.getName();
- int grade = vectorOfObjects[counter].getGrade();
- string name = vectorOfObjects[counter].getName();
- for (vector<int>::iterator it = v.begin(); it!=v.end(); ++it) {
- cout << *it << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement