,   CyberForum.ru

friend private , ? - C++


C++ http://www.cyberforum.ru/cpp-beginners/thread947257.html
69 , , , . . , .
C++ c++ for_each for(microbe &i : microbes) { i.set_speed(diapozon_speed * rand() /RAND_MAX + min_speed ); // int nr = rand() % rings.size(); i.set_ring(rings); i.set_XY(create_point(nr)); i.set_target(create_point(nr)); } http://www.cyberforum.ru/cpp-beginners/thread947254.html
C++
, , , ~1300 , , , , , . case 1:{ Movies = 'O'; switch(FourthMove){ ...
, q C++
, , q. , , , , , ( ). , ,...
C++ http://www.cyberforum.ru/cpp-beginners/thread947215.html
, " ", ). .
C++ ? ! . (long long) , . , , , ... , , - ...

Oman
4 / 4 / 0
: 07.11.2010
: 29
02.09.2013, 17:40  []     friend private , ?
alsav22
, ( ). - 47 . .
, , . .

C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*Í*÷*èòå ñ êë*ññ* person. Ñîçä*éòå ìóëüòèì*îæåñòâî äëÿ õð**å*èÿ óê*ç*-
 òåëåé ** îáúåêòû ýòîãî êë*ññ*. Îïðåäåëèòå åãî ñ ïîìîùüþ ôó*êöèî**ëü-
 *îãî îáúåêò* comparePersons, ÷òîáû ñîðòèðîâê* ïðîèçâîäèë*ñü *âòîì*òè-
 ÷åñêè ïî èìå**ì ëþäåé. Îïðåäåëèòå ñ ïîëäþæè*û ýëåìå*òîâ, â*åñèòå èõ 
 â ìóëüòèì*îæåñòâî. Âûâåäèòå åãî ñîäåðæèìîå. Ç*ä*éòå èìå** ëþäåé 
 ò*êèì îáð*çîì, ÷òîáû *åêîòîðûå èç *èõ ñîâï*ä*ëè. Òåì ñ*ìûì ìîæ*î áó-
 äåò óäîñòîâåðèòüñÿ â òîì, ÷òî ìóëüòèì*îæåñòâî ìîæåò õð**èòü *åñêîëüêî
 îáúåêòîâ ñ îäè**êîâûì êëþ÷îì.*/
#include <iostream>
using namespace std;
#include <set>
#include <algorithm>
#include <string>
 
class person
{
private:
    string lastName;
    string firstName;
    long phoneNumber;
public:
    person() :             // êî*ñòðóêòîð ïî óìîë÷**èþ
      lastName("ïóñòî"), firstName("ïóñòî"), phoneNumber(0L)
      {  }
 
      // êî*ñòðóêòîð ñ òðåìÿ *ðãóìå*ò*ìè
      person(string lana, string fina, long pho) :
      lastName(lana), firstName(fina), phoneNumber(pho)
      {  }
 
      friend bool operator<(const person&, const person&);
      friend bool operator==(const person&, const person&);
 
      void display() const   // âûâîä ïåðñî**ëü*ûõ ä***ûõ
      {
          cout << endl << lastName << ",\t" << firstName
              << "\t\tÒåëåôî*: " << phoneNumber;
      }
 
      long get_phone() const // âåð*óòü òåëåôî**ûé *îìåð
      { return phoneNumber; }
}; // end class person
//---------------------------------------------------------
// ïåðåãðóæå**ûé < äëÿ êë*ññ* person
bool operator<(const person& p1, const person& p2)
{
    if(p1.lastName == p2.lastName)
        return (p1.firstName < p2.firstName) ? true : false;
    return (p1.lastName < p2.lastName) ? true : false;
}
//---------------------------------------------------------
// ïåðåãðóæå**ûé == äëÿ êë*ññ* person
bool operator==(const person& p1, const person& p2)
{
    return (p1.lastName == p2.lastName &&
        p1.firstName == p2.firstName) ? true : false;
}
//---------------------------------------------------------
// ôó*êöèî**ëü*ûé îáúåêò äëÿ ñð*â*èâ**èÿ ñîäåðæèìîãî 
// óê*ç*òåëåé ** îáúåêòû person
class comparePersons
{
public:
    bool operator()(const person* ptrP1,
        const person* ptrP2) const
    { return *ptrP1 < *ptrP2; }
};
//---------------------------------------------------------
// ôó*êöèî**ëü*ûé îáúåêò äëÿ âûâîä* ïåðñî**ëü*ûõ ä***ûõ, 
// õð**èìûõ â óê*ç*òåëÿõ
class displayPerson
{
public:
    void operator()(const person* ptrP) const
    { ptrP->display(); }
};
///////////////////////////////////////////////////////////
 
int main()
{
    system("chcp 1251>nul");
 
    multiset<person*> per;
    per.insert(per,per);
 
    cout << endl;
    return 0;
}
10
ForEveR
Oman, 2013 , . ,

C++
1
2
3
#if _MSC_VER <= 1400  // 1400 == VC++ 8.0
#  define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
#endif
, ( ) , MVC++ 6.0 Borland C++ Builder 5.0. . 2004.
 
: 11:45. GMT +3.
- , ,
-
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
@Mail.ru