-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQ2.cpp
78 lines (72 loc) · 1.43 KB
/
Q2.cpp
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
using namespace std;
int main()
{
int x[4][3],dw[4][3],w[5][3],y[4][1],i,j,p; //Comment1
for(i=0;i<=2;i++)
{//hbchdsbhdsbjdsn//
w[0][i]=0;
}
for(p=1;p<=4;p++)
{
x[p][2]=1;
}
for(p=1;p<=4;p++)
{
cout<<"Enter the input Pattern number "<<p<<" : \n";
for(i=0;i<=1;i++)
{
cout<<"x"<<i+1<<":";
cin>>x[p][i];
}
cout<<"Enter the corresponding output \n";
cin>>y[p][1];
dw[p][2]=y[p][1];
for(i=0;i<=2;i++)
{
if(i<=1)
{
dw[p][i]=x[p][i]*y[p][1];
}
w[p][i]=w[p-1][i]+dw[p][i];
}
}
cout<<"\n";
cout<<" Inputs "<<" "<<"Wgt-Changes"<<" "<<"Weights"<<"\n";
cout<<" x1 x2 b y dw1 dw2 dw3 w1 w2 b"<<"\n";
for(p=1;p<=4;p++)
{
cout<<" ";
for(i=0;i<=2;i++)
{
if(x[p][i]>=0)
{
cout<<" ";
}
cout<<x[p][i]<<" ";
}
if(y[p][1]>=0)
{
cout<<" ";
}
cout<<" "<<y[p][1]<<" ";
for(i=0;i<=2;i++)
{
if(dw[p][i]>=0)
{
cout<<" ";
}
cout<<dw[p][i]<<" ";
}
cout<<" ";
for(i=0;i<=2;i++)
{
if(w[p][i]>=0)
{
cout<<" ";
}
cout<<w[p][i]<<" ";
}
cout<<"\n";
}
return 0;
}