Jump to content

penguinpirate

Member
  • Posts

    1
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United States

Everything posted by penguinpirate

  1. Figured I'd come to a MS forum because this is a question about Visual C++... #include "stdafx.h" #include <iostream> #include <cmath> #using <mscorlib.dll> using namespace std; using namespace System; int _tmain() { int done=1; int a, b, c, d, e, f; double d1, d2, x1new, x2new, x1old, x2old, t1, t2; //Like Newton Raphson... cout<<"Input a value for a (in your system of equations):";cin>>a; cout<<"Input a value for b (in your system of equations):";cin>>b; cout<<"Input a value for c (in your system of equations):";cin>>c; cout<<"Input a value for d (in your system of equations):";cin>>d; cout<<"Input a value for e (in your system of equations):";cin>>e; cout<<"Input a value for f (in your system of equations):";cin>>f; x1old=1; x2old=1; while(done != 0){ x1new=(c - b*x2old)/a; x2new=(f - d*x1old)/e; t1=a*x1new + b*x2new - c; t2=d*x1new + e*x2new - f; if(fabs (t1) < 1.0e-6) d1=1; else d1=0; if(fabs (t2) < 1.0e-6) d2=1; else d2=0; done=d1+d2-2; x1old=x1new; x2old=x2new; } cout<<"The x value is:"<<x1new<<endl; cout<<"The y value is:"<<x2new<<endl; return 0; } It's supposedly a system of equations formula, and unfortunately, I can't see what's wrong with it... if any of you are running Visual's C++ IDE, try it out, no errors at compile time... it runs fine but seems to hang at the calculation. And yes, I'm a n00b.
×
×
  • Create New...