orpheus

Magnetic_Flux

May 16th, 2012
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.06 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6.  
  7. {
  8.     char more, equation;
  9.     float B,I,a;
  10.  
  11.     cout<<"\n\n\t Determine the magnetic field \n\t providing your desired values \n\n";
  12.  
  13.  
  14.     level1:
  15.  
  16.         cout<<"\n\t Enter the values of current I in amp \n\t and \n\t the distance from a wire a in metre:";
  17.  
  18.         cout<<"\t\t\t\n\t current I=";
  19.  
  20.         cin>>I;
  21.  
  22.         cout<<"\t\t Distance from the wire, a=";
  23.  
  24.         cin>>a;
  25.  
  26.         cout<<"\t press y for do it";
  27.  
  28.         cin>>equation;
  29.  
  30.         if (equation=='y')
  31.         {
  32.             B=2*0.0000001*1/a;
  33.             cout<<"\n\t\t"<<B<<" Tesla \n\t is the value of the magnetic field";
  34.         }
  35.  
  36.         cout<<"n\n\t Do you want to calculate more? \n\t If yes please press y\n\t\t\t and \n\t If no please press n to end the program";
  37.  
  38.         cin>>more;
  39.  
  40.         if (more=='y')
  41.         {
  42.             goto level1;
  43.         }
  44.         else
  45.         {
  46.             cout<<"\n\t\t\t Thank you for using the programme \n\t\t\t Good Bye";
  47.         }
  48.        
  49.         return 0;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment