Skip to content

Commit

Permalink
corectare operator <<
Browse files Browse the repository at this point in the history
  • Loading branch information
radumcostache committed Jun 21, 2023
1 parent a2b3ff7 commit 204c6c1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
16 changes: 12 additions & 4 deletions Characteristics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ Characteristics<T>::Characteristics(int a, int b, int c, int d, T t) {
tier = t;
}

template class Characteristics<char>;
template class Characteristics<int>;


template<>
Characteristics<char>::Characteristics(int a, int b, int c, int d) {
Expand All @@ -51,7 +50,16 @@ Characteristics<int>::Characteristics(int a, int b, int c, int d) {
tier = 1;
}

std::ostream & operator<<(std::ostream &out, const Characteristics<char> &c) {
template class Characteristics<char>;
template class Characteristics<int>;

template<typename T>
std::ostream & operator<< (std::ostream &out, const Characteristics<T> &c) {
out << "Tier: " << c.tier << "\n";
return out;
}
}

template
std::ostream& operator<< <>(std::ostream& o, const Characteristics<int>& x);
template
std::ostream& operator<< <>(std::ostream& o, const Characteristics<char>& x);
8 changes: 7 additions & 1 deletion Characteristics.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
#include <iostream>
#include "Rating.h"

template <typename T>
class Characteristics;

template <typename T>
std::ostream& operator<<(std::ostream& o, const Characteristics<T>& c);

template <class T = int>
class Characteristics {
private:
Expand All @@ -22,7 +28,7 @@ class Characteristics {
float getMatching(const Characteristics &c);

void updateCharacteristics(const Characteristics &extra, int multiplier);
friend std::ostream & operator << (std::ostream &out, const Characteristics &c);
friend std::ostream& operator<< <>(std::ostream&, const Characteristics<T>&);
};


Expand Down

10 comments on commit 204c6c1

@mcmarius
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pare gata, aștept titlu în readme și eventual niște explicații. Am încercat mai multe date de intrare, dar nu mă prind cum funcționează, nu îmi recomandă nimic.

@radumcostache
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcmarius Am adaugat titlu si explicatii in readme. Probabil nu a gasit destinatie din cauza ca distanta maxima a fost prea mica (are un numar limitat de destinatii si probabil ca niciuna nu respecta criteriul de distanta maxima).

@mcmarius
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ciudat, ce unitate de măsură? Am pus și 50000 și tot nu a vrut 🤔

@radumcostache
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ciudat. Calculele sunt facute in km (clasa Point). Nu stiu sincer de ce nu a mers (mie imi merge, l-am incercat si pe ala din executabil). Destinatiile sunt Londra, Paris Madrid, Tokyo

@mcmarius
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nu am un profil acceptabil :)) dacă poți să dai 1-2 exemple de date care întorc ceva

@radumcostache
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raspunsurile de la chestionar nu exclud destinatii, doar le schimba ordinea de alegere. Singurul care exclude e criteriul de distanta.
Ex1: Coordonatele pentru Bucuresti (lat: 44.432, long: 26.106), orice raspunsuri la intrebari, dist. max 3000 de km, ar trebui sa dea Madrid sau Paris. (in general da Madrid, care e greu de batut in formular - e best city pt aproape orice- si calculeaza bine distanta)

Update: cred ca e totusi ceva de modificat la functia de calcul pentru distanta. Am incercat sa vad distanta dintre Seoul si Tokyo si mi-a dat ceva imens. Verific si corectez acum.

@radumcostache
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcmarius am dat update la functia de distanta. Acum ar trebui sa mearga

@mcmarius
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there 😄 acum merg distanțele 🎉
Mai e o mică problemă, vezi după examen; ori de la font, ori de la cod, caracterele non-ascii apar ca niște pătrate. Ar fi frumos să rezolvăm și asta

@radumcostache
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcmarius Am rezolvat si cu caracterele non-ascii.

@mcmarius
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ar mai fi să cureți mesajele de afișare că sare în aer consola 🙈 sau poți să lași așa, nu e grav.
O să mă uit pe restul proiectelor și revin la punctaj.

Please sign in to comment.