Insert BS here A place to discuss anything you want!

Need Help With C++

Old Apr 19, 2005 | 11:05 AM
  #1  
ROTARYROCKET7's Avatar
Thread Starter
Senior Member
 
Joined: Dec 2002
Posts: 1,687
From: QUEENS NYC
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;



}
Old Apr 19, 2005 | 11:31 AM
  #2  
drftk1d's Avatar
Senior Member
 
Joined: Apr 2004
Posts: 403
From: NY
Default

if you can wait until thursday, thats when i get home, i can get it and run it for you.
Old Apr 19, 2005 | 11:31 AM
  #3  
boxrs4sale's Avatar
Senior Member
 
Joined: Jul 2003
Posts: 682
From: Delaware
Default

the computer just stared back at me and said...
Old Apr 19, 2005 | 11:47 AM
  #4  
ROTARYROCKET7's Avatar
Thread Starter
Senior Member
 
Joined: Dec 2002
Posts: 1,687
From: QUEENS NYC
Default

i need it today, im going to school in a few hours to run it i got class at 5pm
Old Apr 19, 2005 | 12:10 PM
  #5  
Dysfnctnl85's Avatar
Senior Member
 
Joined: Jul 2002
Posts: 2,483
From: Fayetteville, Georgia
Default

Ummm, how can you take c++ and not have a c compiler?!
Old Apr 19, 2005 | 12:34 PM
  #6  
drftk1d's Avatar
Senior Member
 
Joined: Apr 2004
Posts: 403
From: NY
Default

maybe he is just taking the class at school and didnt want to pay $100 for a verision of c++?
Old Apr 19, 2005 | 01:06 PM
  #7  
Dysfnctnl85's Avatar
Senior Member
 
Joined: Jul 2002
Posts: 2,483
From: Fayetteville, Georgia
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.
Old Apr 19, 2005 | 01:33 PM
  #8  
ROTARYROCKET7's Avatar
Thread Starter
Senior Member
 
Joined: Dec 2002
Posts: 1,687
From: QUEENS NYC
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
Old Apr 19, 2005 | 03:19 PM
  #9  
Tessai's Avatar
Senior Member
 
Joined: Apr 2004
Posts: 224
From: Garland, TX
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.
Old Apr 19, 2005 | 05:34 PM
  #10  
ROTARYROCKET7's Avatar
Thread Starter
Senior Member
 
Joined: Dec 2002
Posts: 1,687
From: QUEENS NYC
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..

Thread Tools
Search this Thread

All times are GMT -5. The time now is 08:19 PM.