3 Replies - 23894 Views - Last Post: 24 September 2008 - 07:05 AM Rate Topic: -----

#1 liko  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 32
  • Joined: 19-April 08

c++ simple program area of a triangle

Posted 24 September 2008 - 12:37 AM

I don't get what i am doing wrong it seems legit but it tells me error. This is the program.

 
//chapter 3 number 5
//create a program that calculates and displays the area of a rectangle given the rectangle's length and width measurements in feet.

#include <iostream>

using namespace std;

int main()
{
	//declare variables
	double lenght	 = 0.0;
	double width	 = 0.0;
	double area		 = 0.0;

	//inpute items
	cout << "Enter lenght: ";
	cin >>	  lenght;
	cout <<	"Enter width: ";
	cin >>	width;

	//Calculate Area
	area = width * lenght

	//Calculate
	cout << "Your area is: " << area << endl;

	return 0;
		// end of main function

}



Help appreciated.

This post has been edited by liko: 24 September 2008 - 12:41 AM


Is This A Good Question/Topic? 0
  • +

Replies To: c++ simple program area of a triangle

#2 liko  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 32
  • Joined: 19-April 08

Re: c++ simple program area of a triangle

Posted 24 September 2008 - 12:45 AM

I just found the errors thanks for the ones that were gona help.
Was This Post Helpful? 0
  • +
  • -

#3 RedSonja  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 10
  • View blog
  • Posts: 172
  • Joined: 04-September 08

Re: c++ simple program area of a triangle

Posted 24 September 2008 - 03:40 AM

If your prof is a terror he might knock off points for spelling "length" wrong...
Was This Post Helpful? 0
  • +
  • -

#4 DoubleFission  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 24
  • View blog
  • Posts: 223
  • Joined: 20-September 08

Re: c++ simple program area of a triangle

Posted 24 September 2008 - 07:05 AM

Well if you want to get the area of a triangle as the thread name suggests, you might want to try changing the area calculation to

area = width/2 * height;



Else it looks fine to me... apart from said spelling errors
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1