i want to rerun this program i need help

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
// Physics theorems
#include<iostream.h>
#include<conio.h>
#include<math.h>
#define pi   3.14159265
#define RPD  (pi/180)
#define DPR  (180/pi)
int main()
{
clrscr();
int p,q,P,Q,pq;
float theeta,Theeta,cA,sA,r,R,tA,alpha;
cout<<"\n\n                     This Is Paralellogram Law Of Vectors";
cout<<"\n\nProvide with values of two vectors and then theeta";
cin>>p>>q>>theeta;
Theeta=theeta*=RPD;
cA=cos(Theeta);
sA=sin(Theeta);
P=p*p;
Q=q*q;
pq=2*p*q*cA;
r=P+Q+pq;
R=pow(r,0.5);
cout<<"\n\nResultant Vector="<<R;
tA=atan((q*sA)/(p+(q*cA)));
alpha=tA*=DPR;
cout<<"\n\nDirection of Resultant="<<alpha<<"°";
getch();


clrscr();
int ax,ay,az,bx,by,bz,ab;
cout<<"\n\n                     Scalar Product of two vectors";
cout<<"\n\nEnter Components of Vector A";
cin>>ax>>ay>>az;
cout<<"\n\n Enter Components of Vector B";
cin>>bx>>by>>bz;
ab=ax*bx+ay*by+az*bz;
cout<<"\n\nScalar Product of Vector="<<ab;
getch();


clrscr();
int px,py,pz,qx,qy,qz,pq1,pq2,pq3;
cout<<"\hn\n                    Vector Profuct of two vectors";
cout<<"\n\nProvide with components of vector P";
cin>>px>>py>>pz;
cout<<"\n\nProvide with components of vector Q";
cin>>qx>>qy>>qz;
pq1=(py*qz)-(pz*qy);
pq2=(pz*qx)-(px*qy);
pq3=(px*qy)-(py*qx);
cout<<"\n\nVector Product of two Vectors=";
cout<<"\n"<<pq1<<"i + "<<pq2<<"j + "<<pq3<<"k";
return 0;

}
Last edited on
Put each part of your code inside of a while loop starting from the first cout until the last one (before each getch()). Something like this:

1
2
3
4
5
6
7
8
9
10
11
... your code ...
while((p * q) != 0)  // when p or q is zero will stop this first part of the programme
 and continue whith the rest one included inside of a while loop.
{
       cout <<"\n\n...and so on

       ......your code....


        cout << "n\nDirection..." << ...
} 

and so on with the rest two parts: Scalar product and Vector product.
Succes!
Last edited on
thankyou very very much for this reply i worked it as you said and relly Succes!!!!!!!!
Topic archived. No new replies allowed.