,   CyberForum.ru

main - C++

 
Spect
1 / 1 / 0
: 17.11.2013
: 75
23.02.2014, 19:06     main #1
- .
, a1,a2,a3,b1... , ?
- , !
.

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
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <math.h>
 
using namespace std;
void R0(double);
 
void if2(double, double, double, double, double, double, double, double, double, double, double,double,double,double,double,double,double,double,double,double);
bool if1(double, double, double, double, double, double, bool);
 
void R0(double r)
{
    while (r<0)
    {
        cout<<"\n   - !\n  \n";
        cin>>r;
    }
 
    while (r==0)
    {
        cout<<"\n   - !\n  \n";
        cin>>r;
    }
}
 
void if2(double x, double y, double x1, double y1, double x2, double y2, double x3, double y3, double R1, double R2, double R3, double y4,double y5,double y6,double a1,double a2,double a3,double b1,double b2,double b3)
{
    
    if ((pow((x-x1),2)+pow((y-y1),2) <= pow(R1,2) || pow((x-x2),2)+pow((y-y2),2) <= pow(R2,2) || pow((x-x3),2)+pow((y-y3),2) <= pow(R3,2)) || ((y>y4)&&(y>y5)&&(y<y6)))
        cout<<"\n    "<<endl;  
    else cout<<"\n     "<<endl;
}
 
 
 
bool if1(double x1, double y1, double x2, double y2, double x3, double y3, bool f)
{
    if (((x2-x1)*(y3-y1) - (y2-y1)*(x3-x1))==0)
    {
        cout<<"\n.     !\n  \n"<<endl;
        return true;
    }
    else return false;
}
 
 
 
int main()
{
    setlocale(LC_ALL,"Russian"); 
    bool f=true;
    double x,y,x1,y1,x2,y2,x3,y3,R1,R2,R3,a1,b1,y4,a2,b2,a3,b3,y5,y6;
    
    do
    {
    cout<<"     1,1:\n";cin>>x1>>y1;
    cout<<"   :";cin>>R1;
    R0(R1);
    cout<<"     2,2:\n";cin>>x2>>y2;
    cout<<"   :"; cin>>R2;
    R0(R2);
    cout<<"     3,3:\n";cin>>x3>>y3;
    cout<<"   :"; cin>>R3;
    R0(R3);
    f= if1(x1, y1, x2, y2, x3, y3,f);
    }
    while (f);
    cout<<" , :\n"; cin>>x>>y;
 
    a1=(y1-y3)/(x1-x3);
    b1=y1-a1*x1;
    y4=a1*x+b1;
    
    a2=(y3-y2)/(x3-x2);
    b2=y3-a2*x3;
    y5=a2*x+b2;
 
    a3=(y2-y1)/(x2-x1);
    b3=y2-a3*x2;
    y6=a3*x+b3;
 
    if2(x,y,x1,y1,x2,y2,x3,y3,R1,R2,R3,y4,y5,y6,a1,a2,a3,b1,b2,b3);
    return 0;
}
Similar
41792 / 34177 / 6122
: 12.04.2006
: 57,940
23.02.2014, 19:06     main
:

int main() return( cmd) C++
. ) C++
C++ main()
C++
C++ main.cpp my.h
.
GuGo1991
267 / 261 / 93
: 02.08.2012
: 609
23.02.2014, 20:20     main #2
Spect, - :
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
#include <iostream>
#include <iomanip>
#include <math.h>
 
using namespace std;
void R0(double);
 
void if2(double, double, double, double, double, double, double, double, double, double, double,double,double,double,double,double,double,double,double,double);
bool if1(double, double, double, double, double, double, bool);
 
void R0(double r)
{
    while (r<0)
    {
        cout<<"\nÐ*äèóñ ìå*üøå *óëÿ - îøèáê*!\nÂâåäèòå ð*äèóñ ïîâòîð*î\n";
        cin>>r;
    }
 
    while (r==0)
    {
        cout<<"\nÐ*äèóñ ð*âå* *óëþ - îøèáê*!\nÂâåäèòå ð*äèóñ ïîâòîð*î\n";
        cin>>r;
    }
}
 
void if2(double x, double y, double x1, double y1, double x2, double y2, double x3, double y3, double R1, double R2, double R3, double y4,double y5,double y6,double a1,double a2,double a3,double b1,double b2,double b3)
{
    
    if ((pow((x-x1),2)+pow((y-y1),2) <= pow(R1,2) || pow((x-x2),2)+pow((y-y2),2) <= pow(R2,2) || pow((x-x3),2)+pow((y-y3),2) <= pow(R3,2)) || ((y>y4)&&(y>y5)&&(y<y6)))
        cout<<"\nÄ****ÿ òî÷ê* ïðè**äëåæèò ç*ä***îé îáë*ñòè"<<endl;  
    else cout<<"\nÄ****ÿ òî÷ê* *å ïðè**äëåæèò ç*ä***îé îáë*ñòè"<<endl;
}
 
 
 
bool if1(double x1, double y1, double x2, double y2, double x3, double y3, bool f)
{
    if (((x2-x1)*(y3-y1) - (y2-y1)*(x3-x1))==0)
    {
        cout<<"\nÎøèáê*.Öå*òðû îêðóæ*îñòåé ëåæ*ò ** îä*îé ïðÿìîé!\nÂâåäèòå èõ ïîâòîð*î\n"<<endl;
        return true;
    }
    else return false;
}
 
double A1(double y1, double y3, double x1, double x3, double a1)
{
    return a1 = (y1-y3)/(x1-x3);
}
 
double B1(double y1, double a1, double x1, double b1)
{
    return b1 = y1-a1*x1;
}
 
double Y4(double a1, double x, double b1, double y4)
{
    return y4 = a1*x+b1;
} 
 
double A2(double y2, double y3, double x2, double x3, double a2)
{
    return a2 = (y3-y2)/(x3-x2);
}
 
double B2(double y3, double a2, double x3, double b2)
{
    return b2 = y3-a2*x3;
}
 
double Y5(double a2, double x, double b2, double y5)
{
    return y5 = a2*x+b2;
}
 
double A3(double y1, double y2, double x1, double x2, double a3)
{
    return a3 = (y2-y1)/(x2-x1);
}
 
double B3(double y2, double a3, double x2, double b3)
{
    return b3 = y2-a3*x2;
}
 
double Y6(double a3, double x, double b3, double y6)
{
    return y6 = a3*x+b3;
}
 
int main()
{
    setlocale(LC_ALL,"Russian"); 
    bool f=true;
    double x,y,x1,y1,x2,y2,x3,y3,R1,R2,R3,a1,b1,y4,a2,b2,a3,b3,y5,y6;
    
    do
    {
    cout<<"Ââåäèòå êîîðäè**òû öå*òð* ïåðâîé îêðóæ*îñòè õ1,ó1:\n";cin>>x1>>y1;
    cout<<"Ââåäèòå ð*äèóñ ä***îé îêðóæ*îñòè:";cin>>R1;
    R0(R1);
    cout<<"Ââåäèòå êîîðäè**òû öå*òð* âòîðîé îêðóæ*îñòè õ2,ó2:\n";cin>>x2>>y2;
    cout<<"Ââåäèòå ð*äèóñ ä***îé îêðóæ*îñòè:"; cin>>R2;
    R0(R2);
    cout<<"Ââåäèòå êîîðäè**òû öå*òð* òðåòüåé îêðóæ*îñòè õ3,ó3:\n";cin>>x3>>y3;
    cout<<"Ââåäèòå ð*äèóñ ä***îé îêðóæ*îñòè:"; cin>>R3;
    R0(R3);
    f= if1(x1, y1, x2, y2, x3, y3,f);
    }
    while (f);
    cout<<"Ââåäèòå õ,ó :\n"; cin>>x>>y;
 
    A1(y1, y3, x1, x3, a1);
    B1(y1, a1, x1, b1);
    Y4(a1, x, b1, y4);
    
    A2(y3, y2, x3, x2, a2);
    B2(y3, a2, x3, b2);
    Y5(a2, x, b2, y5);
 
    A3(y2, y1, x2, x1, a3);
    B3(y2, a3, x2, b3);
    Y6(a3, x, b3, y6);
 
    if2(x,y,x1,y1,x2,y2,x3,y3,R1,R2,R3,y4,y5,y6,a1,a2,a3,b1,b2,b3);
    system("pause");
    return 0;
}

.
main.
Spect
1 / 1 / 0
: 17.11.2013
: 75
23.02.2014, 20:31  []     main #3
GuGo1991
.
main.
,
"The variable 'b3' is being used without being initialized"
GuGo1991
267 / 261 / 93
: 02.08.2012
: 609
23.02.2014, 21:00     main #4
,
Spect, , ...
:
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
#include <iostream>
#include <iomanip>
#include <math.h>
 
using namespace std;
void R0(double);
 
void if2(double, double, double, double, double, double, double, double, double, double, double,double,double,double,double,double,double,double,double,double);
bool if1(double, double, double, double, double, double, bool);
 
void R0(double r)
{
    while (r<0)
    {
        cout<<"\nÐ*äèóñ ìå*üøå *óëÿ - îøèáê*!\nÂâåäèòå ð*äèóñ ïîâòîð*î\n";
        cin>>r;
    }
 
    while (r==0)
    {
        cout<<"\nÐ*äèóñ ð*âå* *óëþ - îøèáê*!\nÂâåäèòå ð*äèóñ ïîâòîð*î\n";
        cin>>r;
    }
}
 
void if2(double x, double y, double x1, double y1, double x2, double y2, double x3, double y3, double R1, double R2, double R3, double y4,double y5,double y6,double a1,double a2,double a3,double b1,double b2,double b3)
{
    
    if ((pow((x-x1),2)+pow((y-y1),2) <= pow(R1,2) || pow((x-x2),2)+pow((y-y2),2) <= pow(R2,2) || pow((x-x3),2)+pow((y-y3),2) <= pow(R3,2)) || ((y>y4)&&(y>y5)&&(y<y6)))
        cout<<"\nÄ****ÿ òî÷ê* ïðè**äëåæèò ç*ä***îé îáë*ñòè"<<endl;  
    else cout<<"\nÄ****ÿ òî÷ê* *å ïðè**äëåæèò ç*ä***îé îáë*ñòè"<<endl;
}
 
 
 
bool if1(double x1, double y1, double x2, double y2, double x3, double y3, bool f)
{
    if (((x2-x1)*(y3-y1) - (y2-y1)*(x3-x1))==0)
    {
        cout<<"\nÎøèáê*.Öå*òðû îêðóæ*îñòåé ëåæ*ò ** îä*îé ïðÿìîé!\nÂâåäèòå èõ ïîâòîð*î\n"<<endl;
        return true;
    }
    else return false;
}
 
double A1(double y1, double y3, double x1, double x3)
{
    return (y1-y3)/(x1-x3);
}
 
double B1(double y1, double a1, double x1)
{
    return y1-a1*x1;
}
 
double Y4(double a1, double x, double b1)
{
    return a1*x+b1;
} 
 
double A2(double y2, double y3, double x2, double x3)
{
    return (y3-y2)/(x3-x2);
}
 
double B2(double y3, double a2, double x3)
{
    return y3-a2*x3;
}
 
double Y5(double a2, double x, double b2)
{
    return a2*x+b2;
}
 
double A3(double y1, double y2, double x1, double x2)
{
    return (y2-y1)/(x2-x1);
}
 
double B3(double y2, double a3, double x2)
{
    return y2-a3*x2;
}
 
double Y6(double a3, double x, double b3)
{
    return a3*x+b3;
}
 
int main()
{
    setlocale(LC_ALL,"Russian"); 
    bool f=true;
    double x,y,x1,y1,x2,y2,x3,y3,R1,R2,R3,a1,b1,y4,a2,b2,a3,b3,y5,y6;
    
    do
    {
    cout<<"Ââåäèòå êîîðäè**òû öå*òð* ïåðâîé îêðóæ*îñòè õ1,ó1:\n";cin>>x1>>y1;
    cout<<"Ââåäèòå ð*äèóñ ä***îé îêðóæ*îñòè:";cin>>R1;
    R0(R1);
    cout<<"Ââåäèòå êîîðäè**òû öå*òð* âòîðîé îêðóæ*îñòè õ2,ó2:\n";cin>>x2>>y2;
    cout<<"Ââåäèòå ð*äèóñ ä***îé îêðóæ*îñòè:"; cin>>R2;
    R0(R2);
    cout<<"Ââåäèòå êîîðäè**òû öå*òð* òðåòüåé îêðóæ*îñòè õ3,ó3:\n";cin>>x3>>y3;
    cout<<"Ââåäèòå ð*äèóñ ä***îé îêðóæ*îñòè:"; cin>>R3;
    R0(R3);
    f= if1(x1, y1, x2, y2, x3, y3,f);
    }
    while (f);
    cout<<"Ââåäèòå õ,ó :\n"; cin>>x>>y;
 
    a1 = A1(y1, y3, x1, x3);
    b1 = B1(y1, a1, x1);
    y4 = Y4(a1, x, b1);
    
    a2 = A2(y3, y2, x3, x2);
    b2 = B2(y3, a2, x3);
    y5 = Y5(a2, x, b2);
 
    a3 = A3(y2, y1, x2, x1);
    b3 = B3(y2, a3, x2);
    y6 = Y6(a3, x, b3);
 
    if2(x,y,x1,y1,x2,y2,x3,y3,R1,R2,R3,y4,y5,y6,a1,a2,a3,b1,b2,b3);
    system("pause");
    return 0;
}
Spect
1 / 1 / 0
: 17.11.2013
: 75
23.02.2014, 21:29  []     main #5
GuGo1991, !
Yandex
23.02.2014, 21:29     main

: 21:02. GMT +3.
- , ,
-
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
@Mail.ru