,   CyberForum.ru

- C++

C++ range-based for http://www.cyberforum.ru/cpp-beginners/thread660554.html
#include <iostream> #include <vector> int main() { std::vector<int> v(30); for (auto z : v) { std::cout<<z<<std::endl; } system("PAUSE"); return 0;
C++ printf scanf , .. : #include <stdio.h> #include <conio.h> #include <locale.h> void main() { setlocale(LC_ALL, "Russian"); // //setlocale(LC_ALL, ".OCP"); // http://www.cyberforum.ru/cpp-beginners/thread660551.html
C++
, !!!! !!!!! {10;11;12;13} y{3;7;11;17} ()=10 ( ~ 16,5) 0, 1, 2, 3 .
C++
: for ( int j=190; j<256; j++) { o=0; for (int i=0; i<r; i++) { z=s1;
C++ http://www.cyberforum.ru/cpp-beginners/thread660522.html
Please help!!! - CDAccount : - private; - member functions: to return the initial balance, to return the final balance, to return the interest rate, to return the term. - member variables default constructor.
C++ UTF-8 . (, 3.1, , , cp866) : void main() { char s; strcpy(s, ""); printf("%c %c", s, s); } , : " ". UTF-8, :...

xxasxx
0 / 0 / 0
: 19.03.2012
: 49
30.09.2012, 04:19    
, ESCAPE?
..
,
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#include <windows.h>
/* ïðîòîòèï ôó*êöèè îê** */
LRESULT CALLBACK WindowFunc(HWND,UINT,WPARAM,LPARAM);
/* ïðîòîòèï ôó*êöèè îòðèñîâêè ãð*ôè÷åñêèõ ïðèìèòèâîâ è âûâîä* òåêñò* */
void DrawMessageAndEllipse(HWND hwnd,int x,int y,char *msg);
char szWinName[] ="MyWin"; /* èìÿ êë*ññ* îê** */
/* ãë*â**ÿ ôó*êöèÿ */
int WINAPI WinMain(HINSTANCE hThisInst, HINSTANCE hPrevInst, 
                   LPSTR lpszArgs, int nWinMode )
{
    /*  äåñêðèïòîð îê** */
    HWND hwnd;
    /* ñîîáùå*èå */
    MSG msg;
    /* êë*ññ îê** */
    WNDCLASSEX wcl;
    /* îïðåäåëå*èå êë*ññ* îê** */
    wcl.hInstance=hThisInst; /* äåñêðèïòîð ä***îãî ýêçåìïëÿð* */
    wcl.lpszClassName=szWinName; /* èìÿ êë*ññ* îê** */
    wcl.lpfnWndProc=WindowFunc; /* ôó*êöèÿ îê** */
    wcl.style=0; /* ñòèëü ïî óìîë÷**èþ */
 
    wcl.cbSize = sizeof(WNDCLASSEX); /*ð*çìåð ñòðóòêòóðû */
                     /* WNDCLASSEX */
    wcl.hIcon = LoadIcon(NULL,IDI_WINLOGO);/* áîëüø*ÿ */
                    /* ïèêòîðãð*ìì* */
    wcl.hIconSm = LoadIcon(NULL,IDI_WINLOGO); /* ì*ë*ÿ */
                      /* ïèêòîãð*ìì* */
    wcl.hCursor = LoadCursor(NULL,IDC_ARROW); /* ôîðì* êóðñîð* */
    wcl.lpszMenuName = NULL; /* ìå*þ *å èñïîëüçóåòñÿ */
    wcl.cbClsExtra = 0; /* äîïîë*èòåëü**ÿ è*ôîðì*öèÿ îòñóòñòâóåò */
    wcl.cbWndExtra = 0; 
    /* ôî* îê** ç*ä*åòñÿ áåëûì */
    wcl.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
    /* ðåãèñòð*öèÿ êë*ññ* îê** */
    if(!RegisterClassEx(&wcl)) return 0;
    /* Ñîçä**èå îê** */
    hwnd = CreateWindow (
        szWinName, /* èìÿ êë*ññ* îê** */
        "Äåìî*ñòð*öèÿ ðèñîâ**èÿ ãð*ôè÷åñêèõ ïðèìèòèâîâ è ð*áîòû ñ ìûøüþ", /* ç*ãîëîâîê */
        WS_CAPTION|WS_BORDER|WS_SYSMENU, /* ñòèëü îê** */
        CW_USEDEFAULT, /* êîîðäè**ò* Õ - îïðåäåëÿåòñÿ Windows */
        CW_USEDEFAULT, /* êîîðäè**ò* Y - îïðåäåëÿåòñÿ Windows */
        CW_USEDEFAULT, /* øèðè** - îïðåäåëÿåòñÿ Windows */
        CW_USEDEFAULT, /* âûñîò* - îïðåäåëÿåòñÿ Windows */
        HWND_DESKTOP,  /* ðîäèòåëüñêîãî îê** *åò */
        NULL, /* ìå*þ *åò */
        hThisInst, /* äåñêðèïòîð ä***îãî ýêçåìïëÿð* ïðèëîæå*èÿ */
        NULL /* äîïîë*èòåëü*ûõ *ðãóìå*òîâ *åò */
    );
    /* îòîáð*æå*èå îê** */
    ShowWindow(hwnd,nWinMode);
    UpdateWindow(hwnd);
    /* öèêë ñîîáùå*èé */
    while (GetMessage(&msg,NULL,0,0))
    {
        TranslateMessage(&msg); /* ð*çðåø*åò
        èñïîëüçîâ**èå êë*âè*òóðû */
        DispatchMessage(&msg);  /* âîçâð*ù*åò óïð*âëå*èå Windows */
    }
    return msg.wParam;
}
/* Ýò* ôó*êöèÿ âûçûâ*åòñÿ Windows 95, êîòîð*ÿ ïåðåä*åò åé */
/* ñîîáùå*èÿ èç î÷åðåäè ñîîáùå*èé */
LRESULT CALLBACK WindowFunc(HWND hwnd, UINT message, WPARAM wParam,
                            LPARAM lParam)
{
    /* êî*òåêñò óñòðîéñòâ* */
    HDC hDC; 
    int xPos,yPos;
    char buf[100];
    switch (message){
    case WM_DESTROY: /* ç*âåðøå*èå ïðîãð*ììû */
        PostQuitMessage(0);
        break;
/*-------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------*/
/*ËÅÂÀß ÊÍÎÏÊÀ*/
 
    case WM_LBUTTONDOWN:
        xPos = LOWORD(lParam);   
        yPos = HIWORD(lParam);  
        if(((xPos>=20)&&(yPos>=20))&&((xPos<=200)&&(yPos<=100)))
        {
            wsprintf(buf,"Âû ïîï*ëè â ïðÿìîóãîëü*èê!");
        }
        else wsprintf(buf,"Çäð*âñòâóé ìèð!                     ");
        hDC=GetDC(hwnd);
        TextOut(hDC,1,1,buf,lstrlen(buf));
        ReleaseDC(hwnd,hDC);
        break;
 
/*ÏÐÀÂÀß ÊÍÎÏÊÀ*/
 
    case WM_RBUTTONDOWN:
        xPos = LOWORD(lParam);   
        yPos = HIWORD(lParam);  
        //650,380,950,680
        if(((xPos>=650)&&(yPos>=380))&&((xPos<=950)&&(yPos<=680)))
        {
            wsprintf(buf,"Âû ïîï*ëè â ýëëèïñ!               ");
        }
        else wsprintf(buf,"Çäð*âñòâóé ìèð!                        ");
        hDC=GetDC(hwnd);
        TextOut(hDC,1,1,buf,lstrlen(buf));
        ReleaseDC(hwnd,hDC);
        break;
/*-------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------*/
 
    /* îáð*áîòê* ñîîáùå*èÿ ïåðåðèñîâêè */
    case WM_PAINT: 
        /* îòðèñîâê* ãð*ôè÷åñêèõ ïðèìèòèâîâ è âûâîä ñîîáùå*èÿ*/
        DrawMessageAndEllipse(hwnd,0,0,"");
        break;
    default:
        /* ïîçâîëÿåò Windows îáð*á*òûâ*òü ëþáûå ñîîáùå*èÿ 
        *åóê*ç***ûå â ïðåäûäóùåì ñëó÷*å */
        return DefWindowProc(hwnd, message,wParam,lParam);
    }
    return 0;
}
/* âûâîäèò ñîîáùå*èå â îê*î â ïîçèöèþ ñ êîîðäè**ò*ìè x,y */
void DrawMessageAndEllipse(HWND hwnd,int x,int y,char *msg)
{
    HDC hDC;
    PAINTSTRUCT paintStruct;
    RECT clientRect;
    /*  îáúÿâëå*èå êèñòè*/
    HBRUSH br1;
    HBRUSH br2;
    HBRUSH br3;
    /* îáúÿâëå*èå öâåòîâ */
    COLORREF color1,color2,color3,color4,color5;
    /* îáúÿâëå*èå */
    HPEN pen1;
    HPEN pen2;
    HPEN pen3;
    /* 32 áèò**ÿ ñòðóêòóð* öâåò* */
    /* ñò*ðøèå äâ* á*éò* = 0 
       ñëåäóþùèå ç*ä*þò ñè*þþ êîìïî*å*òó 
       ñëåäóùèå çåëå*óþ 
       ñëåäóþùèå êð*ñ*óþ */
    /* 0x00bbggrr */
    color1=0x00990000;//blue
    color2=0x00009900;//green
    color3=0x00009999;//yellow
    color4=0x00000099;//red
    color5=0x00000000;//black
    /* ñîçä**èå êèñòåé */ 
    br1=CreateSolidBrush(color1);
    br2=CreateSolidBrush(color2);
    br3=CreateSolidBrush(color3);
    /* ñîçä**èå ïåð*
       1-ûé ï*ð*ìåòð ç*ä*åò ñòèëü 
        PS_DASH - øòðèõ 
        PS_DOT - ïó*êòèð 
        PS_SOLID - ñïëîø*îé
        PS_DASHDOT - øòðèõ - ïó*êòèð
        PS_NULL - *åò ïåð*
       2-îé òîëùè*ó
       3-èé öâåò */ 
pen1=CreatePen(PS_SOLID,3,color4); 
pen2=CreatePen(PS_SOLID,5,color2); 
pen3=CreatePen(PS_SOLID,2,color5); 
    /* ïîëó÷å*èå êî*òåêñò* îê** */ 
    hDC = BeginPaint(hwnd, &paintStruct);
    if (hDC != NULL)
    {
    // ïîëó÷å*èå ïðÿìîóãîëü*èê* êëèå*òñêîãî îê**
    GetClientRect(hwnd, &clientRect);
    // âûáîð êèñòè 
    SelectObject(hDC,br1);
    // âûáîð ïåð*
    SelectObject(hDC,pen1);
    /* ðèñóåò ïðÿìîóãîëü*èê */
Rectangle(hDC,20,20,200,100);
    // âûáîð êèñòè 
    SelectObject(hDC,br3);
    SelectObject(hDC,pen2);
    /* ðèñóåò ýëëèïñ */
    Ellipse(hDC,650,380,950,680);
    SelectObject(hDC,pen3);
    // ç*ä*åò öâåò òåêñò*
    SetTextColor(hDC, RGB(255,0,0));
    /* âûâîä ñîîáùå*èÿ */ 
            TextOut(hDC,x,y,msg,lstrlen(msg));
    /* ðèñóåò òðåóãîëü*èå ïî ëè*èÿì */ 
    /* ç*ä*åò òåêóùóþ ïîçèöèþ */
    /* 1-ûé ï*ð*ìåòð - êî*òåêñò îê** */
    /* 2-îé è 3-èé êîîðäè**òû ïîçèöèè */
    /* 4-*ÿ óê*ç*òåëü ** ñòðóêòóðó - ïðåä ïîçèöèþ */
    MoveToEx(hDC,350,350,NULL);
    /* ðèñóåò ëè*èþ îò ïðåä ïîçèöèè ê ç*ä***îé è ïåðå*îñèò 
       òåêóùóþ ïîçèöèþ â *îâóþ òî÷êó 
       1-ûé ï*ð*ìåòð - êî*òåêñò îê** 
       2-îé ï*ð*ìåòð - *îâ*ÿ òî÷ê*
     */
    LineTo(hDC,350,200);
    LineTo(hDC,550,350);
    LineTo(hDC,350,350);
    /* óä*ëÿåò ïåðî */ 
    DeleteObject(pen1);
    DeleteObject(pen2);
    DeleteObject(pen3);
    /* óä*ëÿåò êèñòè */
    DeleteObject(br1);
    DeleteObject(br2);
            /* îêî*÷**èÿ îòðèñîâêè */
    EndPaint(hwnd, &paintStruct);
    }
}
.
 
: 14:18. GMT +3.
- , ,
-
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
@Mail.ru