help me!

c++ programming

Page 1 of 1

3 Replies - 731 Views - Last Post: 27 March 2008 - 02:05 AM Rate Topic: -----

#1 jajaluv2eat  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 24-March 08

help me!

Posted 24 March 2008 - 09:16 PM

The surface of a certain materials is given by A= ∫(p to q) y dx where y is given as (9 - x2) e(-x/3) and the limits of x is from -3 to +3.

Write a program to numerically integrate A to find out how many square centimeters is the surface area for the given limits. Also display the exact results computed using the indefinite integral e(-x/3) (3x2 + 18x + 27). Using trapezoidal rule.

urgent!!

This post has been edited by jajaluv2eat: 24 March 2008 - 09:18 PM

Is This A Good Question/Topic? 0
  • +

Replies To: help me!

#2 no2pencil  Icon User is offline

  • Admiral Fancy Pants
  • member icon

Reputation: 5355
  • View blog
  • Posts: 27,314
  • Joined: 10-May 07

Re: help me!

Posted 24 March 2008 - 09:26 PM

View Postjajaluv2eat, on 24 Mar, 2008 - 09:16 PM, said:

urgent!!

Wow, urgent.

You might get a better response if you post your question in the C/C++ forum.

Also, you'll want to include any relevant source code for your project, as well as any errors, so we can better assist you with your question.

Welcome to Dream In Code!
Was This Post Helpful? 0
  • +
  • -

#3 jajaluv2eat  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 24-March 08

Re: help me!

Posted 26 March 2008 - 08:38 PM

View Postjajaluv2eat, on 24 Mar, 2008 - 09:16 PM, said:

The surface of a certain materials is given by A= ∫(p to q) y dx where y is given as (9 - x2) e(-x/3) and the limits of x is from -3 to +3.

Write a program to numerically integrate A to find out how many square centimeters is the surface area for the given limits. Also display the exact results computed using the indefinite integral e(-x/3) (3x2 + 18x + 27). Using trapezoidal rule.

urgent!!


#include<stdio.h>
float fn(float k);
main()
{
int i,n;
float a=-3,b=3,h,x,y,area;
printf("enter the number of Trapezoidal: ");
scanf("%d",&n);
h = (b-a)/n;
y=0.0;
for (i=1; i<n; i++)
{
x = a + i*h;
y = y + fn(x);
}
area = h*(y + (fn(a) + fn(B))/2);
printf("\n\nThe area under the curve is %.4f\n\n",area);
system ("pause");
}
float fn(float k)
{
float yy;
yy = (9-k*k)*exp(-k/3);
return yy;
}

-program code must contains function, loop,array/file processing
my program dont have array/file processing..can u guys plz modify my program...thnx 4 your help...
Was This Post Helpful? 0
  • +
  • -

#4 martin_bg  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 20-March 08

Re: help me!

Posted 27 March 2008 - 02:05 AM

Check this out. I think it's going to be useful:

http://www.nrbook.com/a/bookcpdf.php (chapter 4)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1