I need help writing a simple program. My Declaration is: length, width, area and perimeter. My Input is length and width. The Calculations are: p=2*(l+w) and a=l*w and my Output is p and a can anyone please help me write this program. I just started out doing this and I am very confused.

Recommended Answers

All 4 Replies

What code do you have done so far?

EDIT: if your answer is none... start here:

#include <iostream>

using namespace std;

int main(int argc, char **argv)
{
     // Declare Length, width, area and perimeter

     // Display message about length to user
     // Get length from user

     // Display message about width to user
     // Get width from user

     // Calculate perim
     // Calculate area

     // Show perim to user
     // Show area to user

     return 0;
}

thats the code im using but when it comes line 6 i dont know what to type

this is what i have so far:
// Devin Southern
// COSC 112 - Spring 2009
// Dr. Stone
// 2/9/2009
// this program will

#include<iostream>
using namespace std;

int main()
{
//declaration section
integer length, width, area, perimeter;
then i dont know what to type after this line i know i have to display the message about length to the user but i dont know how to word it

Be a part of the DaniWeb community

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