Insert BS here A place to discuss anything you want!

Need Help With C++

Thread Tools
 
Search this Thread
 
Old 04-19-2005, 11:05 AM
  #1  
Senior Member
Thread Starter
 
ROTARYROCKET7's Avatar
 
Join Date: Dec 2002
Location: QUEENS NYC
Posts: 1,687
Default

Im wrote this program for my class but dont have C++ to run it can someone run it and see how it does, errors and what nots?



// Jason Rodriguez

// CE335 Cubic Spline

//Homework # 7



#include<iostream.h>

#include<math.h>



int main ()

{

float t[20], x[20], y[20], b[20], h[20], U[20], V[20], Z[20], A[20], B[20], C[20], D[20], S[20];



int n, i;



cout <<”\n Enter the value for N: “;

cin >>n;



for (i=0; i<=n; i++)

{

cout<<” \n Enter the value for T” <<i<<”:”;

cin >>t[i];

}



cout<<endl<<endl;



for (i=0; i<=n; i++)

{

y[i] = 1 / (1+ pow(t[i],2));

cout<<”\n Y” <<i<<”=”<<y[i]<<endl<<endl;

}



for (i=0; i<=n-1; i++)

{

h[i] = t[i+1] – t[i];

b[i] = (1/h[i]) * (y[i+1] + h[i]);

}



cout<<endl;



for (i=0; i<=1; i++)

{

U[i+1] = 2 * (h[i+1]);

V[i+1] = 6 * (b[i+1]);

}



cout<<endl;



for (i=0; i<=n-1; i++)

{

U[i+1] = (2 * (h[i] + (h[i-1])) - (pow(h[i-1], 2) / U[i-1]);

V[i+1] = (6 * (b[i] - (b[i])) - ((h[i-1] * V[i-1])); // U[i-1]);

}



cout<<endl;





for (i=0; i<=1; i++)

{

z[i] = 0;

z[n] = 0;

}



cout<<endl;



for(i=n-1; i<=1; i--)

{

Z[i] = ((V[i] - (h[i] * Z[i+1]))/ U[i]);

}



cout<<endl<<endl<<endl;



for ( i=0; i<=n; i++)

{

A[i] = y[i];

B[i] = ((-h[i] * Z[i+1])/6) - ((h[i] * Z[i])/3) + ((1/h[i]) * (y[i+1] - y[i]));

C[i] = Z[i]/2;

D[i] = (1/(6* h[i])) * (Z[i+1] - Z[i]);

}



cout<<endl;



for (i=0; i<n-1; i++)

{

x[i] = t[i];

S[i] = A[i] + (B[i] * (X[i] - t[i])) + C[i] * pow((x[i] - t[i], 2)) + (D[i] * pow((x[i] - t[i]), 3));

cout<<"\n S" <<i <<"(x)=" <<S[i];

}



cout<<endl<<endl;



return 0;



}
ROTARYROCKET7 is offline  
Old 04-19-2005, 11:31 AM
  #2  
Senior Member
 
drftk1d's Avatar
 
Join Date: Apr 2004
Location: NY
Posts: 403
Default

if you can wait until thursday, thats when i get home, i can get it and run it for you.
drftk1d is offline  
Old 04-19-2005, 11:31 AM
  #3  
Senior Member
 
boxrs4sale's Avatar
 
Join Date: Jul 2003
Location: Delaware
Posts: 682
Default

the computer just stared back at me and said...
boxrs4sale is offline  
Old 04-19-2005, 11:47 AM
  #4  
Senior Member
Thread Starter
 
ROTARYROCKET7's Avatar
 
Join Date: Dec 2002
Location: QUEENS NYC
Posts: 1,687
Default

i need it today, im going to school in a few hours to run it i got class at 5pm
ROTARYROCKET7 is offline  
Old 04-19-2005, 12:10 PM
  #5  
Senior Member
 
Dysfnctnl85's Avatar
 
Join Date: Jul 2002
Location: Fayetteville, Georgia
Posts: 2,483
Default

Ummm, how can you take c++ and not have a c compiler?!
Dysfnctnl85 is offline  
Old 04-19-2005, 12:34 PM
  #6  
Senior Member
 
drftk1d's Avatar
 
Join Date: Apr 2004
Location: NY
Posts: 403
Default

maybe he is just taking the class at school and didnt want to pay $100 for a verision of c++?
drftk1d is offline  
Old 04-19-2005, 01:06 PM
  #7  
Senior Member
 
Dysfnctnl85's Avatar
 
Join Date: Jul 2002
Location: Fayetteville, Georgia
Posts: 2,483
Default

[quote name='drftk1d' date='Apr 19 2005, 12:34 PM']maybe he is just taking the class at school and didnt want to pay $100 for a verision of c++?

[snapback]701911[/snapback]

[/quote]



Just a thought.
Dysfnctnl85 is offline  
Old 04-19-2005, 01:33 PM
  #8  
Senior Member
Thread Starter
 
ROTARYROCKET7's Avatar
 
Join Date: Dec 2002
Location: QUEENS NYC
Posts: 1,687
Default

[quote name='Dysfnctnl85' date='Apr 19 2005, 09:10 AM']Ummm, how can you take c++ and not have a c compiler?!

[snapback]701904[/snapback]

[/quote]



school has a compiler,



I dont have a computer my computer burnt to the ground im using my girls computer. Plus im doing civil engineering but this CE class we have to use C++ to solve CE problems
ROTARYROCKET7 is offline  
Old 04-19-2005, 03:19 PM
  #9  
Senior Member
 
Tessai's Avatar
 
Join Date: Apr 2004
Location: Garland, TX
Posts: 224
Default

I had a similar problem. Project was due after spring break, I had the project done but no compiler. Emailed the instructor, got a link to Borland to use the free 90-day trial of their compiler, and they emailed me the wrong serial number and passcode! 3 TIMES! I couldn't do any of the work at home, and had no time to go to school during the computer lab's open hours... ended up having to drop the class.
Tessai is offline  
Old 04-19-2005, 05:34 PM
  #10  
Senior Member
Thread Starter
 
ROTARYROCKET7's Avatar
 
Join Date: Dec 2002
Location: QUEENS NYC
Posts: 1,687
Default

[quote name='Tessai' date='Apr 19 2005, 12:19 PM']I had a similar problem. Project was due after spring break, I had the project done but no compiler. Emailed the instructor, got a link to Borland to use the free 90-day trial of their compiler, and they emailed me the wrong serial number and passcode! 3 TIMES! I couldn't do any of the work at home, and had no time to go to school during the computer lab's open hours... ended up having to drop the class.

[snapback]701986[/snapback]

[/quote]



Ouch that sucks balllz..
ROTARYROCKET7 is offline  


Quick Reply: Need Help With C++



All times are GMT -5. The time now is 12:53 PM.