Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Whenever I try to run the program and access the 3rd display function I keep getting an error saying Invalid Pointer: Memory Aborted. All the

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Whenever I try to run the program and access the 3rd "display" function I keep getting an error saying "Invalid Pointer: Memory Aborted." All the other functions are working properly but somehow I can not figure out this error. I would appreciate it if you can help

1 36 I 2 void search(string); void exportResults(); float findMinimum(int*,int); 3 4 #include #include #include #include #include #include #include #include 5 6 chandel 7 int main() { while(1) { int ch; 8 9 10 using namespace std; yaparan mahuping point TE 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 11 int no_of_test = 5; 12 13 14 15 16 17 cout>ch; string sid; choice c; 21 22 56 57 58 23 24 59 60 61 wat 25 26 27 28 29 30 62 struct student { string name; string id; int no_of_test; int *test_scores; float avg_scores; }; 63 64 65 switch(ch) { case Add: add_student(); break; case Remove: cout>sid; remove_student(sid); break; case 3: display(); break; case Search: 66 67 68 31 32 33 34 35 36 void add_student(); void remove_student(string); void display(); void search(string); 69 70 71 107 108 109 void add_student() { struct student s; string fname, lname; 110 n2wa 111 112 71 72 73 74 75 76 77 78 79 80 81 82 83 case Search: cout>sid; search(sid); break; case Result: exportResults(); break; case Quit: exit(0); default: cout>s.id; cout>s.no_of_test; s.test_scores = new int(s.no_of_test); we lethedarkan secara lua martial arts and the for(int i=0;i>s.test_scores[i]; EL 134 } 135 136 137 138 102 103 139 ofstream of; of.open("student.dat", ios::app); of>students[i].no_of_test; 181 182 147 148 } 183 184 perti mana ping pong 185 186 void remove_student(string sid) { int stu_no = getline(); stu_no--; struct student students[stu_no]; students[i].test_scores=new int(students[i].no_of_test); 187 188 189 for(int j = 4,k=0; j>students[i].test_scores[k]; } 190 191 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 ifstream fin; fin.open("student.dat"); 192 193 194 195 if( sid.compare(students[i].id) == 0 ) { flag = true; } we lethedral sala de aulability and the late live 196 197 198 string line; int i=0; bool flag=false; vector result; while('fin.eof()) { getline(fin, line); if ( line.size() == 0 ) break; result.clear(); stringstream s_stream(line); //create string stream from the string i++; } 199 200 201 202 203 167 if(flag==true) { ofstream of; of.open("studenti.dat"); 204 205 206 207 168 169 170 171 172 173 174 175 176 177 while(s_stream.good()) { string substr; getline(s_stream, substr, ','); //get string delimited by comma result.push_back(substr); } 208 209 for(int j=0; j>students.no_of_test; 264 265 void search(string sid) { int stu_no = getline(); stu_no--; struct student students; US students.test_scores=new int(result.size()-4-1); 234 266 267 268 269 270 271 272 273 274 ifstream fin; fin.open("student.dat"); = for(int j = 4,k=0; j>students.test_scores[k]; } 235 236 237 238 239 240 241 242 243 244 245 246 247 string line; int i=0; bool flag = false; vector result; wakati and 275 276 277 flag = true; break; } i++; 278 279 while(!fin.eof()) { getline(fin, line); if ( line.size() == 0 ) break; 280 } 281 282 if(flag==true) 282 317 318 283 284 319 320 321 while(s_stream.good()) { string substr; getline(s_stream, substr, ','); //get first string delimited by comma result.push_back(substr); } 322 if(flag==true) { cout>students[i].no_of_test; } students[i].test_scores = new int(students[i].no_of_test); void display() { ifstream fin; fin.open("student.dat"); a new videos and photos and videos and politics , for(int j = 4,k=0; j>students[i].test_scores[k]; } i++; 303 304 int stu_no = getline(); struct student students[stu_no-1]; 339 340 305 306 string line; int i=0; toda ekol , } fin.close(); 307 308 309 310 311 312 313 314 315 316 317 vector result; while(!fin.eof()) { getline(fin, line); if ( line.size() == 0 ) break; result.clear(); stringstream s_stream(line); //create string stream from the string 341 342 343 344 345 346 347 348 349 350 351 352 for(int j=0; j>students[i].no_of_test; ni pa } 393 394 students[i].test_scores = new int(no_of_test); void exportResults() { int stu_no = getline(); stu_no--; struct student students[stu_no]; 395 396 397 EM 398 for(int j = 4,k=0; j>students[i].test_scores[k]; } 399 ofstream of; of.open("average.dat"); 400 401 i++; 402 403 } 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 ifstream fin; fin.open("student.dat"); US string line; int i=0; bool flag=false; vector result; while('fin.eof()) { getline(fin, line); if ( line.size() == 0 ) break; result.clear(); stringstream s_stream(line); //create string stream from the string 404 405 406 407 408 409 410 411 412 for(int i=0;i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What is the abbreivation for the steps of a TCP handshake?

Answered: 1 week ago