Last night, I figured out how to write my psedocode for fing the area of a trapazoid. It was hard but I managed. Now I need help with writing the program. Everytime I try to run it something a little box comes on screen and says error, but I don't know what it is. Can someody, anybody please help me!

THIS IS THE PROGRAM

PROGRAM Trapezoid
!-----------------------------------------------------------
! My Name Here CS 212/Math 201 February, 2 2006
! Assignment #2
!
! Program to calculate the area of the trapezoid.
! Base1, Base2, Area, Sum : the four real numbers
! Height : the integer number
! Area : one-half the height times the sum of Base1 and Base2
! Sum : the sum of Base1 and Base2
!
! Output: Title, Base1, Base2, Height, Area
!---------------------------------------------------------------------------------------

IMPLICIT NONE
REAL :: Base1, Base2, Area, Sum
INTEGER :: Height

Height = 3

! Calculate the sum of Base1 and Base2

Sum = Base1 + Base2

! Now Calculate the Area

Area = .05*Height*Sum

PRINT *, "Trapezoid Area Computation"

PRINT *, "The lenght of the first base:", READ *, Base1, PRINT *, Base1
PRINT *, "The lenght of the second base:", READ *, Base2, PRINT *, Base2
PRINT *, "The height:", Height
PRINT *, "The area:", Area

END PROGRAM Trapezoid

Ok am I missing something or have you not attempted the code since you say you get an error on the screen. To me thats not C / C++ . . .

Can you post your code? Does it have to be in OOPS (C++) or pure C ?

perhaps this could be your statring point...

``````#include <iostream>
using namespace std;

int main()
{
//declare your var's here and set them to a value... normally 0
//
//

return 0;
}``````

Thanks. I figured out what the problem was. I was suppose to declare the real values of Base1 and Base2 before I cumputed the area (and sum). See that way, when I run the program, I will be able to type in my own values for Base1 and Base2.

Ok am I missing something or have you not attempted the code since you say you get an error on the screen. To me thats not C / C++ . . .

Can you post your code? Does it have to be in OOPS (C++) or pure C ?

perhaps this could be your statring point...

``````#include <iostream>
using namespace std;

int main()
{
//declare your var's here and set them to a value... normally 0
//
//

return 0;
}``````
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.