{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Solutii7 - Capitolul 7 E7.4 Se creaz un vector de patru...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Capitolul 7 E7.4. Se crează un vector de patru obiecte din clasa String , svect[4] . La crearea acestui vector este apelat constructorul implicit al clasei String , deci obiectele trebuie să fie setate la valorile dorite ale şirurilor de caractere, folosind funcţia operator de asignare. Sortarea se execută prin apelul funcţiei template sort(). void ft3(){ String svect[4]; svect[0] = "BCD"; svect[1] = "ABC"; svect[2] = "GHFJ"; svect[3] = "MNG"; sort(svect,4); for (int i=0;i<4;i++) cout << svect[i]<< endl; } E7.5. Eroarea de compilare din instrucţiunea for (; iter; ++iter) apare datorită faptului că nu se poate folosi obiectul iter de clasă MapIter într-o expresie condiţională dacă nu există un operator de conversie la un tip de date care să poată fi comparat cu zero. În locul operatorului de conversie operator void*() se poate folosi un operator de convesie la valoare de tip întreg astfel: operator int() { return (int)node; } În acest caz, ultimul câmp afişat în fiecare linie este valoarea pointerului node convertită în întreg şi afişată zecimal.
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern