File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010#include < cstdlib>
1111#include < ctime>
1212
13+ // Include only for convert int to string
14+ #include < sstream>
15+
1316
1417using namespace std ;
1518
Original file line number Diff line number Diff line change @@ -31,7 +31,13 @@ int main(int argc, char* argv[]) {
3131 for (int i=0 ; i<size_stud ; i++) {
3232 if (i % 6 == 0 && i != 0 ) nf++;
3333
34- students[i] = new Student (" Student_name" + to_string (i), nf%3 , i%6 );
34+ // Converting int to string
35+ // Could use to_string, but not available in c++98
36+ ostringstream str1;
37+ str1 << i;
38+ string temp = str1.str ();
39+
40+ students[i] = new Student (" Student_name" + temp, nf%3 , i%6 );
3541 }
3642
3743 int size_teacher = 3 * 6 ;
@@ -41,7 +47,13 @@ int main(int argc, char* argv[]) {
4147 for (int i=0 ; i<size_teacher ; i++) {
4248 if (i % 6 == 0 && i != 0 ) nf++;
4349
44- teachers[i] = new Teacher (" Teacher_name" + to_string (i), nf, i%6 );
50+ // Converting int to string
51+ // Could use to_string, but not available in c++98
52+ ostringstream str1;
53+ str1 << i;
54+ string temp = str1.str ();
55+
56+ teachers[i] = new Teacher (" Teacher_name" + temp, nf, i%6 );
4557 }
4658
4759
You can’t perform that action at this time.
0 commit comments