,   CyberForum.ru

- C++

C++ error C2064: , 0 http://www.cyberforum.ru/cpp-beginners/thread694266.html
! "error C2064: , 0 ". IDE vc++ #pragma once #include "rgb2hsl.h" #include <vector> #include <iostream> using namespace std;
C++ .h , .h #ifndef B_H #define B_H #include "A.h" class B:public A{ ......} #endif B_H main() http://www.cyberforum.ru/cpp-beginners/thread694263.html
C++
. :#include <cstdio> template <int n> class B { public: int size; int a; B() : size(n) { printf( "B::B()\n" ); for ( int i = 0; i < size; i++ ) {
sqrt int , double flot? C++
sqrt int , double float? .
C++ http://www.cyberforum.ru/cpp-beginners/thread694239.html
n #include<iostream> using namespace std; int main() {int str; for (int i=0;i<=9;i++) {cout<<str<<" , ";} cout<<endl;
C++ ! , , , : 1. ,,,,. 2. ? 3. ...

Grifin
0 / 0 / 0
: 11.11.2012
: 20
11.11.2012, 01:34    
...
setlocale(LC_ALL, "Russian");, int main, ...
. !
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
#include <iostream> // ïîäêëþ÷*å
#include <cmath>
#include <locale>
#include <locale.h>
#include <cstdlib>
 
 
using namespace std;
 
template<class T>
class vector3d // êë*ññ òðåõìåð*îãî âåêòîð*
{
public:
   
vector3d();
    ~vector3d();
 
     void SetVector(const char * const caption); // ôó*êöèÿ ïîçâîëÿåò ââåñòè êîîðäè**òû âåêòîð*
    void display(const char * const caption); // ôó*êöèÿ âûâîäÿù*ÿ âåêòîð ** ýêð**
 
   void summ(vector3d *vec1, vector3d *vec2); // ïîëó÷*åò âåêòîð ñóììû
   
void razn(vector3d *vec1, vector3d *vec2); // ïîëó÷*åò âåêòîð ð*ç*îñòè
   
void dlina(vector3d *vec1); // âû÷èñëÿåò äëè*ó âåêòîð*
    void scalar(vector3d *vec1, vector3d *vec2); // ñê*ëÿð*î óì*îæ*åò âåêòîð*
   
void cosinus(vector3d *vec1, vector3d *vec2); // âûâîäèò êîñè*óñ óãë* ìåæäó âåêòîð*ìè
private: T x, y, z; // ñ*ìè êîîðäè**òû
};
 
template<class T>
vector3d<T>::vector3d() // êî*ñòðóêòîð êë*ññ*
{
    x = T(0);
      y = T(0);
    z = T(0);
}
 
template<class T>
vector3d<T>::~vector3d() //ïóñòîé äåñòðóêòîð
{
}
 
template<class T>
void
vector3d<T>::SetVector(const char * const caption)
{
     cout<< caption << endl;
     cout << "X = ";
 
  cin >> x; // ââîäèì êîîðäè**òû âåêòîð*
    cout << "Y =";
     cin >> y;
      cout << "Z = ";
 
   cin >> z;
}
 
template<class T>
void
vector3d<T>::summ(vector3d *vec1, vector3d *vec2)
{
    x = vec1->x + vec2->x; // ñêë*äûâ*åì êîîðäè**òû âåêòîðîâ
    y = vec1->y + vec2->y;
      z = vec1->z + vec2->z;
}
 
template<class T>
void vector3d<T>::razn(vector3d *vec1,vector3d *vec2)
{
    x = vec1->x - vec2->x; // âû÷èò*åì êîîðäè**òû âåêòîðîâ
    y = vec1->y - vec2->y;
    z = vec1->z - vec2->z;
}
 
template<class T>
void vector3d<T>::dlina(vector3d *vec1)
{
     cout << "Äð:" << endl; // *èæå ìû âû÷èñëÿåì ïî ôðìóëå äëè*ó âåêòîð*
    float u = sqrt((vec1->x * vec1->x) + (vec1->y * vec1->y) + (vec1->z * vec1->z));
     cout << u << endl;
}
 
template<class T>
void
vector3d<T>::scalar(vector3d *vec1, vector3d *vec2)
{
      float dot = (vec1->x * vec2->x) + (vec1->y * vec2->y) + (vec1->z * vec2->z);  // ñòðî÷ê* âûøå óì*îæ*åò ñê*ëÿð*î äâ* âåêòîð*
   
cout << "ÐÅÇÓËÜÒÀÒ ÑÊÀËßÐÍÎÃÎ ÏÐÎÈÇÂÅÄÅÍÈß ÂÅÊÒÎÐÎÂ:" << endl << dot << endl;
}
 
template<class T>
void vector3d<T>::cosinus(vector3d *vec1,vector3d *vec2)
{
    float dot = (vec1->x * vec2->x) + (vec1->y * vec2->y) + (vec1->z * vec2->z);
    float u = sqrt((vec1->x * vec1->x) + (vec1->y * vec1->y) + (vec1->z * vec1->z));
    float u2 = sqrt((vec2->x * vec2->x) + (vec2->y * vec2->y) + (vec2->z * vec2->z)); // ïî ôîðìóëå **õîäèì êîñè*óñ óãë* ìåæäó âåêòîð*ìè
    float cos = (dot / (u * u2));
 
 
   cout << "ÊÎÑÈÍÓÑ ÓÃËÀ ÌÅÆÄÓ ÂÅÊÒÎÐÀÌÈ:" << endl << cos << endl;
}
 
template <class T>
void vector3d<T>::display(const char * const caption)
{
    cout<< caption << endl
        << "Âåêòîð ñ êîîðäè**ò*ìè:" << endl
       << "X = " << x << endl << "Y = " << y << endl  << "Z = " << z << endl;
}
 
int main(int argc, char *argv[])
{
 
locale::global(locale("")); // îáüÿâëÿåì ýêçåìïëÿðû êë*ññ*, ó **ñ 2 âåêòîð* äëÿ ð*áîòû è îäè* äëÿ ðåçóëüò*òîâ
   
vector3d<float> *vector1 = new vector3d<float>;
   
vector3d<float> *vector2 = new vector3d<float>;
   
vector3d<float> *result_vector = new vector3d<float>;
 
  
 int p; // ïåðåìå***ÿ äëÿ âûáîð* â ìå*þ ä*ëåå ñ*ìî ìå*þ
     while
(true)
    {
        cout <<
"------------------------ÌÅÍÞ-------------------------" <<
endl
          << "\t1 - Ñëîæå*èå äâóõ âåêòîðîâ"
<< endl
           << "\t2 - Ð*ç*îñòü äâóõ âåêòîðîâ" << endl
          << "\t3 - Âûñ÷èò*òü äëè*ó âåêòð*" << endl
        <<
"\t4 - Ñê*ëÿð*îå ïðîèçâåäå*èå âåêòîðîâ" << endl
           
     << "\t5 - Êîñè*óñ óãë* ìåæäó âåêòîð*ìè" << endl
          << "\t0 - Âûõîä èç ïðîãð*ììû" << endl <<
"-----------------------------------------------------" <<
endl;
 
     cin >> p;
          system("cls"); // î÷èñòèì ýêð**
 
        switch (p) // ñìîòðèì ÷òî âûáð*ëè â ìå*þ è âûçûâ*åì ñîîòâåòñòâóþùèå ôó*êöèè
          {
         case 1:
     
      vector1->SetVector("Ââåäèòå êîîðäè**òû âåêòîð* 1:");
  
     vector2->SetVector("Ââåäèòå êîîðäè**òû âåêòîð* 2:");
          result_vector->summ(vector1, vector2);
        
result_vector->display("-----------ÐÅÇÓËÜÒÀÒ----------");
   
    break;
        case 2:
        
vector1->SetVector("Ââåäèòå êîîðäè**òû âåêòîð* 1:");
        
   vector2->SetVector("Ââåäèòå êîîðäè**òû âåêòîð* 2:");
     
      result_vector->razn(vector1, vector2);
        
result_vector->display("-----------ÐÅÇÓËÜÒÀÒ----------");
   
    break;
        case 3:
        
vector1->SetVector("Ââåäèòå êîîðäè**òû âåêòîð*:");
           
 result_vector->dlina(vector1);
        break;
    case 4:
          vector1->SetVector("Ââåäèòå êîîðäè**òû âåêòîð* 1:");
        vector2->SetVector("Ââåäèòå êîîðäè**òû âåêòîð* 2:");
        result_vector->scalar(vector1,
vector2);
       break;
        case 5:
           
vector1->SetVector("Ââåäèòå êîîðäè**òû âåêòîð* 1:");
        
   vector2->SetVector("Ââåäèòå êîîðäè**òû âåêòîð* 2:");
     
      result_vector->cosinus(vector1, vector2);
        break;
      case 0:
       exit(0);
         break;
      
 }
    }
 
    system("PAUSE");
     return
EXIT_SUCCESS;
}
.
 
: 18:57. GMT +3.
- , ,
-
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
@Mail.ru