PLS HELP ME TO CODE THE MAGNETIC FIELD AT A POINT FROM A CIRCULAR CURRENT LOOP BY BIOT-SAVART LAW.PLS HELP NEED TO SUBMIT COMPUTER PROJECT WILL DUE TOMMORROW PLSSSSS
HERE IS CODE BY MY OWN WAY


#include <iostream>
#include <conio.h>
#include <stdlib.h>
#define M 4*3.14*10^-7
main()
{
float B,N,I,R;
cout<<"Enter the no of the turns,N: /n";
cin>>N;
cout<<"Enter the intensity of current,I: /n";
cin>>I;
cout<<"Enter the magnitude of Resistance,R: /n";
cin>>R;
int x;
cout<<"Distance from the center of the coil to the point where field is to be calculated,x: /n";
cin>>x;
const float PI=3.14;
B=N*I*R*R/2[R*R+x+x]^3/2;
cout<<"The Magnetic field at the point is "<<B<<"T";
return0;
}

Comments
CAPITAL LETTERS + HOMEWORK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Please don't type in all caps no need to YELL lol.

What's the problem with the program? Is it not giving you the result you expect or are there errors? Please be more specific.

Please place your code in [code] //code here [/code] (it's not too late to edit your post).

B=N*I*R*R/2[R*R+x+x]^3/2;

Is not a valid C/C++ syntax. the ^ operator is not for power (it's binary XOR which I doubt is what you intended). C/C++ is not matlab or mathematica or a hand calculator.

If the function is, as I understand it: B = (N * I * R * R) / (2 * (R^2 + x^2)^(3/2))
Then in C++ it is:

B = N * I * R * R / (2.0 * pow(R*R + x*x, 3.0 / 2.0));

BTW: the value R is the radius of the coil, not the resistance, and x should be declared as a float. Oh and PI = 3.14159.. not 3.14.

Is not a valid C/C++ syntax. the ^ operator is not for power (it's binary XOR which I doubt is what you intended). C/C++ is not matlab or mathematica or a hand calculator.

If the function is, as I understand it: B = (N * I * R * R) / (2 * (R^2 + x^2)^(3/2))
Then in C++ it is:

B = N * I * R * R / (2.0 * pow(R*R + x*x, 3.0 / 2.0));

BTW: the value R is the radius of the coil, not the resistance, and x should be declared as a float. Oh and PI = 3.14159.. not 3.14.

thanks

Are you kidding.. it's been twenty days and you still haven't had to hand-in your assignment, such a trivial one too. Man... talk about easy grades..

here it is.. so that you stop crying about it:

#include <iostream>
#include <cmath>

int main()
{
  float B,N,I,R;
  cout<<"Enter the no of the turns,N: \n";
  cin>>N;
  cout<<"Enter the intensity of current,I: \n";
  cin>>I;
  cout<<"Enter the magnitude of Resistance,R: \n";
  cin>>R;
  int x;
  cout<<"Distance from the center of the coil to the point where field is to be calculated,x: \n";
  cin>>x;

  B = N * I * R * R / (2.0 * pow(R*R + x*x, 3.0 / 2.0));

  cout<<"The Magnetic field at the point is "<<B<<"T";
  return 0;
}

see... all I had to do is put that one line I posted earlier into your code. How hard was that for you to do?
In the future, you should know that putting many sss after pls only convinces people that for you, begging is easier than reading, thinking and learning. In other words, it tells people: I'm lazy and stupid, please pity me enough to give me a free-pass. Well I do pity you, and the above is the only pocket-change I can give you.

This article has been dead for over six months. Start a new discussion instead.