-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathq7.cpp
89 lines (81 loc) · 1.98 KB
/
q7.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
79
80
81
82
83
84
85
86
87
88
#include <iostream>
using namespace std;
int main()
{
int x[4][4],dw[4][2],w[4][5][2],t[4][2],i,j,p;
for(p=1;p<=4;p++)
{
for(i=1;i<=2;i++)
{
w[0][p][i]=0;
}
}
for(p=1;p<=4;p++)
{
cout<<"Enter the input Pattern number "<<p<<" : \n";
for(i=0;i<=3;i++)
{
cout<<"s"<<i+1<<":";
cin>>x[p][i];
}
cout<<"Enter the corresponding output \n";
for(i=1;i<=2;i++)
{
cout<<"t"<<i<<":";
cin>>t[p][i];
}
}
k=1;
while(k<=4)
{
for(p=1;p<=2;p++)
{
for(i=1;i<=4;i++)
{
dw[i][p]=x[k][i]*t[k][p];
w[i][p]=w[i-1][p]+dw[i][p];
}
}
w[0][1]=w[
k++;
}
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;
}