Форум программистов, компьютерный форум, киберфорум
С++ для начинающих
Войти
Регистрация
Восстановить пароль
Карта форума Темы раздела Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.88/32: Рейтинг темы: голосов - 32, средняя оценка - 4.88
5 / 5 / 1
Регистрация: 16.04.2010
Сообщений: 64
1

Программа компилируется в Borland 6.0 но не компилируется в Visual Studio 2008

20.04.2010, 21:06. Показов 5733. Ответов 9
Метки нет (Все метки)

Author24 — интернет-сервис помощи студентам
Ета програма компилируетса в борланде 6.0 но не компилируетса в Visualstudio 2008 и в борланде 10-м почему?

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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
#include<iostream>
#include<conio.h>
#include<stdio.h>
#include <windows.h>
using namespace std;
void enter(int&);
void enter(int &X){
        bool flag = true;
        int i = 0;
        char c = 0, x[10];
        x[0] = 'x';
 
        while(flag == true){
                c = getch();
                if(c == 8){
                        if(x[i] != 'x'){
                                cout << "\b \b";
                                x[(i--)-1] /= 10;
                        }
                        if(i == 0)x[i] = 'x';
                }
                if(c >= '0' && c <= '9'||c=='-'||c=='.'){
                        x[i] = c;
                        cout << x[i];
                        i++;
                }
                if(c == 13 && x[i] != 'x')
                flag = false;  }
        X = atof(x);
        }
//--
void enter1(int&);
void enter1(float &X){
        bool flag = true;
        int i = 0;
        char c = 0, x[10];
        x[0] = 'x';
 
        while(flag == true){
                c = getch();
                if(c == 8){
                        if(x[i] != 'x'){
                                cout << "\b \b";
                                x[(i--)-1] /= 10;
                        }
                        if(i == 0)x[i] = 'x';
                }
                if(c >= '0' && c <= '9'||c=='-'||c=='.'){
                        x[i] = c;
                        cout << x[i];
                        i++;
                }
                if(c == 13 && x[i] != 'x')
                flag = false;  }
        X = atof(x);
        }
///--------class
class matr{
public:
char metca;
float a[30][33][33],n[33][33];
float D,Dx,x,Dy,y,z,Dz;
int rr[100],rs[100];
void vvid(int*,int*,int*);
void vuvid(int*);
void mnoz(int*,int*,int*);
void trans(int*);
void ppc(int*);
};
//------------------ clas VVID---------
void matr::vvid(int *i,int *w,int *e){
cout<<"Vvedite matricu#"<<*i<<endl;
//cout<<"vvedite rozmirnist matricu";
//cin>>r;
rr[*i]=*e;
rs[*i]=*w;
for(int u=1;u<=*w;u++){
for(int y=1;y<=*e;y++){
cout<<"->";enter1(a[*i][u][y]);cout<<"\n";
}}}
//-----------------clas VUVID---------
void matr::vuvid(int *c){
cout<<"matrica#"<<*c<<endl;
for(int u=1;u<=rs[*c];u++){
for(int y=1;y<=rr[*c];y++){
cout<<a[*c][u][y]<<" ";
if(y==rr[*c])cout<<endl;
}}}
//--------------clas mnozennya--------
void matr::mnoz(int *z,int *x,int *v)
{
//if(rr[*z]!=rr[*x]){cout<<"rizni vumirnosti";getch();goto A;}
rr[*v]=rr[*z];
rs[*v]=rr[*z];
for(int u=1;u<=rs[*z];u++){
for(int y=1;y<=rr[*z];y++){
a[*v][u][y]=a[*z][u][y]*a[*x][u][y];
cout<<a[*v][u][y]<<" ";
if(y==rr[*z])cout<<endl;
}}}
//----------clas transponuvaniye------
void matr::trans(int *b)
{if(rs[*b]!=rr[*b]){cout<<"matricu nevozmozno transponuvatu"<<endl;goto z;}
for(int u=1;u<=rs[*b];u++){
for(int y=1;y<=rr[*b];y++){
cout<<a[*b][u][y]<<" ";
if(y==rr[*b])cout<<endl;
n[y][u]=a[*b][u][y];}}
cout<<"-----------"<<endl;
for(int u=1;u<=rs[*b];u++){
for(int y=1;y<=rr[*b];y++){
a[*b][u][y]=n[u][y];
cout<<a[*b][u][y]<<" ";
if(y==rr[*b])cout<<endl;}}
z:
getch();
}
//----
void matr::ppc(int *n){
if(rr[*n]!=4){cout<<"obschet nezmozen";goto c;}
if(rs[*n]!=3){cout<<"obschet nezmozen";goto c;}
D=a[*n][1][1]*a[*n][2][2]*a[*n][3][3]+a[*n][1][2]*a[*n][2][3]*a[*n][3][1]+a[*n][2][1]*a[*n][3][2]*a[*n][1][3]-a[*n][1][3]*a[*n][2][2]*a[*n][3][1]-a[*n][2][1]*a[*n][1][2]*a[*n][3][3]-a[*n][3][2]*a[*n][2][3]*a[*n][1][1];
Dx=a[*n][1][4]*a[*n][2][2]*a[*n][3][3]+a[*n][1][2]*a[*n][2][3]*a[*n][3][4]+a[*n][3][2]*a[*n][2][4]*a[*n][1][3]-a[*n][1][3]*a[*n][2][2]*a[*n][3][4]-a[*n][2][4]*a[*n][1][2]*a[*n][3][3]-a[*n][3][2]*a[*n][2][3]*a[*n][1][4];
Dy=a[*n][1][1]*a[*n][2][4]*a[*n][3][3]+a[*n][1][4]*a[*n][2][3]*a[*n][3][1]+a[*n][3][4]*a[*n][2][1]*a[*n][1][3]-a[*n][1][3]*a[*n][2][4]*a[*n][3][1]-a[*n][2][1]*a[*n][1][4]*a[*n][3][3]-a[*n][3][4]*a[*n][2][3]*a[*n][1][1];
Dz=a[*n][1][1]*a[*n][2][2]*a[*n][3][4]+a[*n][3][2]*a[*n][2][1]*a[*n][1][4]+a[*n][1][2]*a[*n][2][4]*a[*n][3][1]-a[*n][1][4]*a[*n][2][2]*a[*n][3][1]-a[*n][3][2]*a[*n][2][4]*a[*n][1][1]-a[*n][2][1]*a[*n][1][2]*a[*n][3][4];
/*if(D==0){cout<<"neverno";goto c;}
if(Dx==0){cout<<"bezkonechno rozvazkiv";goto c;}
if(Dy==0){cout<<"bezkonechno rozvazkiv";goto c;}
if(Dz==0){cout<<"bezkonechno rozvazkiv";goto c;}*/
x=Dx/D;
y=Dy/D;
z=Dz/D;
//--vuvod--
cout<<"Otvet:"<<endl;
cout<<"D="<<D<<endl;
cout<<"Dx="<<Dx<<endl;
cout<<"Dy="<<Dy<<endl;
cout<<"Dz="<<Dz<<endl;
cout<<"X=Dx/D="<<x<<endl;
cout<<"Y=Dy/D="<<y<<endl;
cout<<"Z=Dz/D="<<z<<endl;
c:
getch();
}
//-----------------------------------------------------------------
//-----------------------------------------------------------------
//-----------------------------------------------------------------
//-----------------------------------------------------------------
int s=0,q1[100],q2[100];
matr m;
char botton;
//---                                            vvod danux
 
void input()
{
int o,p;
char metca;
//gotoxy(3,3);
do{
s++;
cout<<"vvedit kilkist ryadkov \n";
enter(o);q1[s]=o; cout<<"\n";
cout<<"vvedit kilkist elemntov ryadka \n";
enter(p);q2[s]=p; cout<<"\n";
m.vvid(&s,&o,&p);
cout<<"prodovzuvati?";
cin>>metca;
}while((metca)!='n');}
//---                                            mnozenya matric
void mnozeniye (){
int b,n;
//gotoxy(3,3);
cout<<"vvedite matricu yaki hotite pomnozit \n";
enter(b);cout<<"\n";
enter(n);cout<<"\n";
m.vuvid(&b);
cout<<"mnozitsa na \n";
m.vuvid(&n);
 if(q1[b]==q1[n]){
 if(q2[b]==q2[n]){
 s++;
 cout<<"nomer novostvorenoy matricu-"<<s<<endl;;
m.mnoz(&b,&n,&s);}
else {cout<<"rizni vumirnosti";goto A;}
}else {cout<<"rizni vumirnosti";goto A;}
//cout<<"nomer novostvorenoy matricu-"<<s;
A:
getch();
}
//---                                            vuvid matricu--
void vuvodm()
{
int l;
cout<<"kakuyu matricu hotite vuvesti?-";
enter(l);cout<<"\n";
m.vuvid(&l);
getch();
}
//----                                          mm
void mmmmm()
{
int r;
cout<<"kakuyu matricu poschutati?";
enter(r);cout<<"\n";
m.ppc(&r);
getch();
}
//------                                         transponuvaniye
void transponuvaniye(){
int l;
cout<<"kakuyu matricu transponaovati->";
enter(l);cout<<"\n";
m.trans(&l);
}
//-----------------menu------
void menu()
{
system("clr");
//gotoxy(17,3);
printf("natusnit vidpovidnu klanishe na klaviature");
//gotoxy(17,5);
printf("dlya vuhoda natusnit 'E'");
//gotoxy(17,7);
cprintf("1)Vvod");
//gotoxy(17,9);
cprintf("2)Mnozennya");
//gotoxy(17,11);
cprintf("3)Transponuvannya");
//gotoxy(17,13);
cprintf("4)Metod Kramera");
//gotoxy(17,15);
cprintf("5)Vuvod matricu");
}
//-----------------------
char key(){
botton=getch();
system("clr");
switch(botton)
        {case'1':{system("clr");input();system("clr");break;}
         case'2':{system("clr");mnozeniye();system("clr");break;}
         case'3':{system("clr");transponuvaniye();system("clr");break;}
             case'4':{system("clr");mmmmm();system("clr");break;}
             case'5':{system("clr");vuvodm();system("clr");break;}
         case'e':exit(0);break;
         default:printf("povtorite vubor");break;
        }return botton;
}
//-------programa--------
int main()
{
system("clr");
while(1)
{
 menu();
 key();
 while(!getch());
}
return 0;}
и единственое уведомление об ошыбке вот оно не могу понят что ето згачит
Компоновка...
MSVCRT.lib(crtexew.obj) : error LNK2001: неразрешенный внешний символ "_WinMain@16"
E:\Visual Studio Projects\Projects\Roma\Release\Roma.exe : fatal error LNK1120: 1 неразрешенных внешних элементов
Журнал построения был сохранен в "file://e:\Visual Studio Projects\Projects\Roma\Roma\Release\BuildLog.htm"
Roma - ошибок 2, предупреждений 0
========== Построение: успешно: 0, с ошибками: 1, без изменений: 0, пропущено: 0 ==========
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
20.04.2010, 21:06
Ответы с готовыми решениями:

Почему Visual Studio показывает ошибку, но программа компилируется и работает?
template &lt;typename T&gt; struct MyType { friend std::ostream &amp;operator&lt;&lt;(std::ostream &amp;out, const...

Visual Studio не компилируется программа. Ошибка в iostream.h (no such file or directory). В чем проблема?
У меня стоит Visual Studio 2010 Premium. Я написал код:...

Visual Studio 2010 (Не компилируется ни одна программа. Даже та,которую мастер создал автоматически!)
Не компилируется ни одна программа. Даже та,которую мастер создал автоматически!Не знаю даже на что...

Не компилируется в Visual Studio 2012
Не понимаю в чем проблема. В NetBeans IDE компилировалось, а в Visual Studio почему-то нет. Нужна...

9
Peace 2 all shining faces
674 / 535 / 85
Регистрация: 05.03.2010
Сообщений: 1,282
20.04.2010, 21:21 2
прототипы функций не нужно объявлять, если сама ф-ция описывается перед ф-цией main();
хм..напишите в самом начале
C++
1
#include "stdafx.h"
у меня работает
очистить экран:
C++
1
system("cls"); //а не "clr"
в Visual Studio 2008
работает
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
#include "stdafx.h"
#include<iostream>
#include<conio.h>
#include<stdio.h>
#include <windows.h>
using namespace std;
//void enter(int&);
void enter(int &X){
        bool flag = true;
        int i = 0;
        char c = 0, x[10];
        x[0] = 'x';
 
        while(flag == true){
                c = getch();
                if(c == 8){
                        if(x[i] != 'x'){
                                cout << "\b \b";
                                x[(i--)-1] /= 10;
                        }
                        if(i == 0)x[i] = 'x';
                }
                if(c >= '0' && c <= '9'||c=='-'||c=='.'){
                        x[i] = c;
                        cout << x[i];
                        i++;
                }
                if(c == 13 && x[i] != 'x')
                flag = false;  }
        X = atof(x);
        }
//--
void enter1(int&);
void enter1(float &X){
        bool flag = true;
        int i = 0;
        char c = 0, x[10];
        x[0] = 'x';
 
        while(flag == true){
                c = getch();
                if(c == 8){
                        if(x[i] != 'x'){
                                cout << "\b \b";
                                x[(i--)-1] /= 10;
                        }
                        if(i == 0)x[i] = 'x';
                }
                if(c >= '0' && c <= '9'||c=='-'||c=='.'){
                        x[i] = c;
                        cout << x[i];
                        i++;
                }
                if(c == 13 && x[i] != 'x')
                flag = false;  }
        X = atof(x);
        }
///--------class
class matr{
public:
char metca;
float a[30][33][33],n[33][33];
float D,Dx,x,Dy,y,z,Dz;
int rr[100],rs[100];
void vvid(int*,int*,int*);
void vuvid(int*);
void mnoz(int*,int*,int*);
void trans(int*);
void ppc(int*);
};
//------------------ clas VVID---------
void matr::vvid(int *i,int *w,int *e){
cout<<"Vvedite matricu#"<<*i<<endl;
//cout<<"vvedite rozmirnist matricu";
//cin>>r;
rr[*i]=*e;
rs[*i]=*w;
for(int u=1;u<=*w;u++){
for(int y=1;y<=*e;y++){
cout<<"->";enter1(a[*i][u][y]);cout<<"\n";
}}}
//-----------------clas VUVID---------
void matr::vuvid(int *c){
cout<<"matrica#"<<*c<<endl;
for(int u=1;u<=rs[*c];u++){
for(int y=1;y<=rr[*c];y++){
cout<<a[*c][u][y]<<" ";
if(y==rr[*c])cout<<endl;
}}}
//--------------clas mnozennya--------
void matr::mnoz(int *z,int *x,int *v)
{
//if(rr[*z]!=rr[*x]){cout<<"rizni vumirnosti";getch();goto A;}
rr[*v]=rr[*z];
rs[*v]=rr[*z];
for(int u=1;u<=rs[*z];u++){
for(int y=1;y<=rr[*z];y++){
a[*v][u][y]=a[*z][u][y]*a[*x][u][y];
cout<<a[*v][u][y]<<" ";
if(y==rr[*z])cout<<endl;
}}}
//----------clas transponuvaniye------
void matr::trans(int *b)
{if(rs[*b]!=rr[*b]){cout<<"matricu nevozmozno transponuvatu"<<endl;goto z;}
for(int u=1;u<=rs[*b];u++){
for(int y=1;y<=rr[*b];y++){
cout<<a[*b][u][y]<<" ";
if(y==rr[*b])cout<<endl;
n[y][u]=a[*b][u][y];}}
cout<<"-----------"<<endl;
for(int u=1;u<=rs[*b];u++){
for(int y=1;y<=rr[*b];y++){
a[*b][u][y]=n[u][y];
cout<<a[*b][u][y]<<" ";
if(y==rr[*b])cout<<endl;}}
z:
getch();
}
//----
void matr::ppc(int *n){
if(rr[*n]!=4){cout<<"obschet nezmozen";goto c;}
if(rs[*n]!=3){cout<<"obschet nezmozen";goto c;}
D=a[*n][1][1]*a[*n][2][2]*a[*n][3][3]+a[*n][1][2]*a[*n][2][3]*a[*n][3][1]+a[*n][2][1]*a[*n][3][2]*a[*n][1][3]-a[*n][1][3]*a[*n][2][2]*a[*n][3][1]-a[*n][2][1]*a[*n][1][2]*a[*n][3][3]-a[*n][3][2]*a[*n][2][3]*a[*n][1][1];
Dx=a[*n][1][4]*a[*n][2][2]*a[*n][3][3]+a[*n][1][2]*a[*n][2][3]*a[*n][3][4]+a[*n][3][2]*a[*n][2][4]*a[*n][1][3]-a[*n][1][3]*a[*n][2][2]*a[*n][3][4]-a[*n][2][4]*a[*n][1][2]*a[*n][3][3]-a[*n][3][2]*a[*n][2][3]*a[*n][1][4];
Dy=a[*n][1][1]*a[*n][2][4]*a[*n][3][3]+a[*n][1][4]*a[*n][2][3]*a[*n][3][1]+a[*n][3][4]*a[*n][2][1]*a[*n][1][3]-a[*n][1][3]*a[*n][2][4]*a[*n][3][1]-a[*n][2][1]*a[*n][1][4]*a[*n][3][3]-a[*n][3][4]*a[*n][2][3]*a[*n][1][1];
Dz=a[*n][1][1]*a[*n][2][2]*a[*n][3][4]+a[*n][3][2]*a[*n][2][1]*a[*n][1][4]+a[*n][1][2]*a[*n][2][4]*a[*n][3][1]-a[*n][1][4]*a[*n][2][2]*a[*n][3][1]-a[*n][3][2]*a[*n][2][4]*a[*n][1][1]-a[*n][2][1]*a[*n][1][2]*a[*n][3][4];
/*if(D==0){cout<<"neverno";goto c;}
if(Dx==0){cout<<"bezkonechno rozvazkiv";goto c;}
if(Dy==0){cout<<"bezkonechno rozvazkiv";goto c;}
if(Dz==0){cout<<"bezkonechno rozvazkiv";goto c;}*/
x=Dx/D;
y=Dy/D;
z=Dz/D;
//--vuvod--
cout<<"Otvet:"<<endl;
cout<<"D="<<D<<endl;
cout<<"Dx="<<Dx<<endl;
cout<<"Dy="<<Dy<<endl;
cout<<"Dz="<<Dz<<endl;
cout<<"X=Dx/D="<<x<<endl;
cout<<"Y=Dy/D="<<y<<endl;
cout<<"Z=Dz/D="<<z<<endl;
c:
getch();
}
//-----------------------------------------------------------------
//-----------------------------------------------------------------
//-----------------------------------------------------------------
//-----------------------------------------------------------------
int s=0,q1[100],q2[100];
matr m;
char botton;
//---                                            vvod danux
 
void input()
{
int o,p;
char metca;
//gotoxy(3,3);
do{
s++;
cout<<"vvedit kilkist ryadkov \n";
enter(o);q1[s]=o; cout<<"\n";
cout<<"vvedit kilkist elemntov ryadka \n";
enter(p);q2[s]=p; cout<<"\n";
m.vvid(&s,&o,&p);
cout<<"prodovzuvati?";
cin>>metca;
}while((metca)!='n');}
//---                                            mnozenya matric
void mnozeniye (){
int b,n;
//gotoxy(3,3);
cout<<"vvedite matricu yaki hotite pomnozit \n";
enter(b);cout<<"\n";
enter(n);cout<<"\n";
m.vuvid(&b);
cout<<"mnozitsa na \n";
m.vuvid(&n);
 if(q1[b]==q1[n]){
 if(q2[b]==q2[n]){
 s++;
 cout<<"nomer novostvorenoy matricu-"<<s<<endl;;
m.mnoz(&b,&n,&s);}
else {cout<<"rizni vumirnosti";goto A;}
}else {cout<<"rizni vumirnosti";goto A;}
//cout<<"nomer novostvorenoy matricu-"<<s;
A:
getch();
}
//---                                            vuvid matricu--
void vuvodm()
{
int l;
cout<<"kakuyu matricu hotite vuvesti?-";
enter(l);cout<<"\n";
m.vuvid(&l);
getch();
}
//----                                          mm
void mmmmm()
{
int r;
cout<<"kakuyu matricu poschutati?";
enter(r);cout<<"\n";
m.ppc(&r);
getch();
}
//------                                         transponuvaniye
void transponuvaniye(){
int l;
cout<<"kakuyu matricu transponaovati->";
enter(l);cout<<"\n";
m.trans(&l);
}
//-----------------menu------
void menu()
{
system("cls");
//gotoxy(17,3);
printf("natusnit vidpovidnu klanishe na klaviature\n");
//gotoxy(17,5);
printf("dlya vuhoda natusnit 'E'\n");
//gotoxy(17,7);
cprintf("1)Vvod\n");
//gotoxy(17,9);
cprintf("2)Mnozennya\n");
//gotoxy(17,11);
cprintf("3)Transponuvannya\n");
//gotoxy(17,13);
cprintf("4)Metod Kramera\n");
//gotoxy(17,15);
cprintf("5)Vuvod matricu\n");
}
//-----------------------
char key(){
botton=getch();
system("cls");
switch(botton)
        {case'1':{system("cls");input();system("cls");break;}
         case'2':{system("cls");mnozeniye();system("cls");break;}
         case'3':{system("cls");transponuvaniye();system("cls");break;}
             case'4':{system("cls");mmmmm();system("cls");break;}
             case'5':{system("cls");vuvodm();system("cls");break;}
         case'e':exit(0);break;
         default:printf("povtorite vubor");break;
        }return botton;
}
//-------programa--------
int main()
{
system("cls");
while(1)
{
 menu();
 key();
 while(!getch());
}
return 0;
}
0
5 / 5 / 1
Регистрация: 16.04.2010
Сообщений: 64
20.04.2010, 22:32  [ТС] 3
ну зделал все как нада но не компилирует вижуал у мну
но кинул другу он чуть переделал и у него скомпилировало
кинул мне не компилирует ппц
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
#include<iostream>
#include<conio.h>
#include<stdio.h>
#include <locale>// пiдключаемо локалiзацiї
#include <windows.h>
using namespace std;
//void enter(int&);
void enter(int &X){
        bool flag = true;
        int i = 0;
        char c = 0, x[10];
        x[0] = 'x';
 
        while(flag == true){
                c = getch();
                if(c == 8){
                        if(x[i] != 'x'){
                                cout << "\b \b";
                                x[(i--)-1] /= 10;
                        }
                        if(i == 0)x[i] = 'x';
                }
                if(c >= '0' && c <= '9'||c=='-'||c=='.'){
                        x[i] = c;
                        cout << x[i];
                        i++;
                }
                if(c == 13 && x[i] != 'x')
                flag = false;  }
        X = atof(x);
        }
//--
void enter1(int&);
void enter1(float &X){
        bool flag = true;
        int i = 0;
        char c = 0, x[10];
        x[0] = 'x';
 
        while(flag == true){
                c = getch();
                if(c == 8){
                        if(x[i] != 'x'){
                                cout << "\b \b";
                                x[(i--)-1] /= 10;
                        }
                        if(i == 0)x[i] = 'x';
                }
                if(c >= '0' && c <= '9'||c=='-'||c=='.'){
                        x[i] = c;
                        cout << x[i];
                        i++;
                }
                if(c == 13 && x[i] != 'x')
                flag = false;  }
        X = atof(x);
        }
///--------class
class matr{
public:
char metca;
float a[30][33][33],n[33][33];
float D,Dx,x,Dy,y,z,Dz;
int rr[100],rs[100];
void vvid(int*,int*,int*);
void vuvid(int*);
void mnoz(int*,int*,int*);
void trans(int*);
void ppc(int*);
};
//------------------ clas VVID---------
void matr::vvid(int *i,int *w,int *e){
cout<<"Введiть матрицю#"<<*i<<endl;
//cout<<"vvedite rozmirnist matricu";
//cin>>r;
rr[*i]=*e;
rs[*i]=*w;
for(int u=1;u<=*w;u++){
for(int y=1;y<=*e;y++){
cout<<"->";enter1(a[*i][u][y]);cout<<"\n";
}}}
//-----------------clas VUVID---------
void matr::vuvid(int *c){
cout<<"Матриця#"<<*c<<endl;
for(int u=1;u<=rs[*c];u++){
for(int y=1;y<=rr[*c];y++){
cout<<a[*c][u][y]<<" ";
if(y==rr[*c])cout<<endl;
}}}
//--------------clas mnozennya--------
void matr::mnoz(int *z,int *x,int *v)
{
//if(rr[*z]!=rr[*x]){cout<<"rizni vumirnosti";getch();goto A;}
rr[*v]=rr[*z];
rs[*v]=rr[*z];
for(int u=1;u<=rs[*z];u++){
for(int y=1;y<=rr[*z];y++){
a[*v][u][y]=a[*z][u][y]*a[*x][u][y];
cout<<a[*v][u][y]<<" ";
if(y==rr[*z])cout<<endl;
}}}
//----------clas transponuvaniye------
void matr::trans(int *b)
{if(rs[*b]!=rr[*b]){cout<<"Матрицю неможлыво транспонувати"<<endl;goto z;}
for(int u=1;u<=rs[*b];u++){
for(int y=1;y<=rr[*b];y++){
cout<<a[*b][u][y]<<" ";
if(y==rr[*b])cout<<endl;
n[y][u]=a[*b][u][y];}}
cout<<"-----------"<<endl;
for(int u=1;u<=rs[*b];u++){
for(int y=1;y<=rr[*b];y++){
a[*b][u][y]=n[u][y];
cout<<a[*b][u][y]<<" ";
if(y==rr[*b])cout<<endl;}}
z:
getch();
}
//----
void matr::ppc(int *n){
if(rr[*n]!=4){cout<<"Обрахунок неможлывий";goto c;}
if(rs[*n]!=3){cout<<"Обрахунок Неможлывий";goto c;}
D=a[*n][1][1]*a[*n][2][2]*a[*n][3][3]+a[*n][1][2]*a[*n][2][3]*a[*n][3][1]+a[*n][2][1]*a[*n][3][2]*a[*n][1][3]-a[*n][1][3]*a[*n][2][2]*a[*n][3][1]-a[*n][2][1]*a[*n][1][2]*a[*n][3][3]-a[*n][3][2]*a[*n][2][3]*a[*n][1][1];
Dx=a[*n][1][4]*a[*n][2][2]*a[*n][3][3]+a[*n][1][2]*a[*n][2][3]*a[*n][3][4]+a[*n][3][2]*a[*n][2][4]*a[*n][1][3]-a[*n][1][3]*a[*n][2][2]*a[*n][3][4]-a[*n][2][4]*a[*n][1][2]*a[*n][3][3]-a[*n][3][2]*a[*n][2][3]*a[*n][1][4];
Dy=a[*n][1][1]*a[*n][2][4]*a[*n][3][3]+a[*n][1][4]*a[*n][2][3]*a[*n][3][1]+a[*n][3][4]*a[*n][2][1]*a[*n][1][3]-a[*n][1][3]*a[*n][2][4]*a[*n][3][1]-a[*n][2][1]*a[*n][1][4]*a[*n][3][3]-a[*n][3][4]*a[*n][2][3]*a[*n][1][1];
Dz=a[*n][1][1]*a[*n][2][2]*a[*n][3][4]+a[*n][3][2]*a[*n][2][1]*a[*n][1][4]+a[*n][1][2]*a[*n][2][4]*a[*n][3][1]-a[*n][1][4]*a[*n][2][2]*a[*n][3][1]-a[*n][3][2]*a[*n][2][4]*a[*n][1][1]-a[*n][2][1]*a[*n][1][2]*a[*n][3][4];
if(D==0){cout<<"Неверно Д=0";goto c;}
if(Dx==0){cout<<"Безкiнечно розвязкiв";goto c;}
if(Dy==0){cout<<"Безкiнечно розвязкiв";goto c;}
if(Dz==0){cout<<"Безкiнечно розвязкiв";goto c;}
x=Dx/D;
y=Dy/D;
z=Dz/D;
//--vuvod--
cout<<"Otvet:"<<endl;
cout<<"D="<<D<<endl;
cout<<"Dx="<<Dx<<endl;
cout<<"Dy="<<Dy<<endl;
cout<<"Dz="<<Dz<<endl;
cout<<"X=Dx/D="<<x<<endl;
cout<<"Y=Dy/D="<<y<<endl;
cout<<"Z=Dz/D="<<z<<endl;
c:
getch();
}
//-----------------------------------------------------------------
//-----------------------------------------------------------------
//-----------------------------------------------------------------
//-----------------------------------------------------------------
int s=0,q1[100],q2[100];
matr m;
char botton;
//---                                            vvod danux
 
void input()
{
int o,p;
char metca;
//gotoxy(3,3);
do{
s++;
cout<<"Введiть кiлькiсть рядкiв \n";
enter(o);q1[s]=o; cout<<"\n";
cout<<"Введiть кiлькiсть столбцiв \n";
enter(p);q2[s]=p; cout<<"\n";
m.vvid(&s,&o,&p);
cout<<"Продовжувати ?";
cin>>metca;
}while((metca)!='n');}
//---                                            mnozenya matric
void mnozeniye (){
int b,n;
//gotoxy(3,3);
cout<<"Введiть матрыцi якм траба помножити \n";
enter(b);cout<<"\n";
enter(n);cout<<"\n";
m.vuvid(&b);
cout<<"Множится на \n";
m.vuvid(&n);
 if(q1[b]==q1[n]){
 if(q2[b]==q2[n]){
 s++;
 cout<<"Номер новоствореної марицi-"<<s<<endl;;
m.mnoz(&b,&n,&s);}
else {cout<<"Рiзнi вимiрностi";goto A;}
}else {cout<<"Рiзнi вимiрностi";goto A;}
//cout<<"nomer novostvorenoy matricu-"<<s;
A:
getch();
}
//---                                            vuvid matricu--
void vuvodm()
{
int l;
cout<<"Яку матрицю хочите вивести?-";
enter(l);cout<<"\n";
m.vuvid(&l);
getch();
}
//----                                          mm
void mmmmm()
{
int r;
cout<<"Яку матрицю обрахувати?";
enter(r);cout<<"\n";
m.ppc(&r);
getch();
}
//------                                         transponuvaniye
void transponuvaniye(){
int l;
cout<<"Яку матрицю транспонувати->";
enter(l);cout<<"\n";
m.trans(&l);
}
//-----------------menu------
void menu()
{
system("cls");
printf("\n \n ");
printf("            Натиснiть вiдповiдну клавiшу на клавiатуре\n");
printf("            Щоб вийти натиснiть 'E'\n");
cprintf("                 1)Ввiд\n");
cprintf("                 2)Множення\n");
cprintf("                 3)Транспонування\n");
cprintf("                 4)Метод крамера\n");
cprintf("                 5)Вивiд матрицi\n");
}
//-----------------------
char key(){
botton=getch();
system("cls");
switch(botton)
            {case'1':{system("cls");input();system("cls");break;}
             case'2':{system("cls");mnozeniye();system("cls");break;}
             case'3':{system("cls");transponuvaniye();system("cls");break;}
             case'4':{system("cls");mmmmm();system("cls");break;}
             case'5':{system("cls");vuvodm();system("cls");break;}
             case'e':exit(0);break;
             default:printf("povtorite vubor");break;
            }return botton;
}
//-------programa--------
int main()
{
    setlocale(LC_ALL,"rus");//вiмнкнення росiйської локалiзацiї
system("cls");
while(1)
{
 menu();
 key();
 while(!getch());
}
return 0;
}
ну что не так????

SVCRTD.lib(crtexew.obj) : error LNK2019: ссылка на неразрешенный внешний символ _WinMain@16 в функции ___tmainCRTStartup
E:\Visual Studio Projects\Projects\Roma\Debug\Roma.exe : fatal error LNK1120: 1 неразрешенных внешних элементов
Журнал построения был сохранен в "file://e:\Visual Studio Projects\Projects\Roma\Roma\Debug\BuildLog.htm"
Roma - ошибок 2, предупреждений 0
========== Построение: успешно: 0, с ошибками: 1, без изменений: 0, пропущено: 0 ==========
0
Эксперт С++
2347 / 1720 / 148
Регистрация: 06.03.2009
Сообщений: 3,675
20.04.2010, 22:39 4
Morfiy, пошагово, с подробностями, расскажи как ты создавал проект в MSVS.
0
5 / 5 / 1
Регистрация: 16.04.2010
Сообщений: 64
22.04.2010, 22:31  [ТС] 5
Цитата Сообщение от CyBOSSeR Посмотреть сообщение
Morfiy, пошагово, с подробностями, расскажи как ты создавал проект в MSVS.
все я нашол проблему я создавал пустой проект где небыло #include "stdafx.h"
)
0
Эксперт С++
2347 / 1720 / 148
Регистрация: 06.03.2009
Сообщений: 3,675
22.04.2010, 23:05 6
Morfiy, зачем #include "stdafx.h"?
0
12 / 12 / 3
Регистрация: 15.04.2010
Сообщений: 31
22.04.2010, 23:20 7
Мда.. Похоже в настройках проекта target system стояла windows...
Не совсем понятно как stdafx это пофиксил...

Другой вариант, если бы вместо main юзалась бы _tmain то была бы похожая ошибка, тогда это бы решалось подключением tchar.h, в котором и определено _tmain(), а так чтот совсем непонятно (((

Добавлено через 1 минуту
непонятно, потому как в пустом проекте этот код отлично линкуется
0
5 / 5 / 1
Регистрация: 16.04.2010
Сообщений: 64
23.04.2010, 11:47  [ТС] 8
Цитата Сообщение от CyBOSSeR Посмотреть сообщение
Morfiy, зачем #include "stdafx.h"?
если чесно я ее добавил по совету вороны(читай выше) хотя оно должно и так компиоировать
но в Вижуале без нее ни как
А в борланде 6.0 оно спокойно компилируетса без ее.
и кстати мож кто знает как в борлагде 6.0 поставить чоб руский шрифт розпознавало?
тут читал не чо не помогло русские шрифты в консоли
0
Peace 2 all shining faces
674 / 535 / 85
Регистрация: 05.03.2010
Сообщений: 1,282
23.04.2010, 12:06 9
сам недели 2 назад попробовал писать в VS, но пока не знаю, как отключить необходимость подключения stdaf.h, но слышал, что в неких опциях можно, если так, то скажите где)
0
Эксперт С++
2347 / 1720 / 148
Регистрация: 06.03.2009
Сообщений: 3,675
23.04.2010, 21:32 10
Цитата Сообщение от Vorona Посмотреть сообщение
сам недели 2 назад попробовал писать в VS, но пока не знаю, как отключить необходимость подключения stdaf.h, но слышал, что в неких опциях можно, если так, то скажите где)
Нужно просто создавать пустой проект.
File->New->Project->Visual C++->Win32->Console Application. Вводим имя проекта, нажимаем OK. В открывшемся окне жмем Next и устанавливаем опцию Empty Project.

stdafx.h нужен для предкомпилированных заголовков, что для небольших проектов преимуществ никаких не даст.
0
23.04.2010, 21:32
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
23.04.2010, 21:32
Помогаю со студенческими работами здесь

Не компилируется проект в Visual Studio
Подскажите пожалуйста, в чём может быть дело? Я установил Visual Studio 2013 и пытаюсь...

Не компилируется библиотека Visual Studio 2017
Здраствуйте. Пишу библиотеку. В какой то момент stl сал себя очень странно вести. Declare.h:...

Не компилируется проект в Visual Studio 2012
Здраствуйте. Подскажите пожалуйста, я установил Visual Studio 2012. Пишу простенькую...

Не компилируется .cpp файл в visual studio
Не могу скомпилировать .cpp файл в visual studio c++ express 2010. В Visual Studio 2013 Community...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
10
Ответ Создать тему
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru