#include "function.h" int main() { ifstream myfile("student.txt"); char ch[100]; if (myfile.is_open()) { string line; while (getline(myfile, line)) { strcpy(ch, line.c_str()); char* p = strtok(ch, "-"); while (p) { string temp = p; if (temp[0] == ' ') temp = temp.substr(1); if (temp[temp.length() - 1] == ' ') temp = temp.substr(0, temp.length()); cout << temp << endl; p = strtok(NULL, "-"); } } myfile.close(); } else cout << "Error opening file."; }