i'm currently a student learning programming and i have a part of the for loop where i couldn't get the output as i wanted = (
i can't seem to be able to figure out how to fix the coding partCode:a[0] = aaa a[1] = bbb I'm actually iterating through a vector searching for a string. void print() { cout<<"Advisor name = "<<getName()<<endl; for(int i = 0;i<a.size();i++) { if (a[i].getName() == b) { a[i].print(); break; } else { cout<<"There is no such advisor"<<endl; } / } if i key in aaa or bbb, my expected out put should key out aaa or bbb but if i key in anything else, it would give and output of There is no such advisor
anyone mind guiding me ??





Reply With Quote