473,388 Members | 1,327 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

area of square

6
How do you write a C++ program that computes the area of a square (area=x*x)
Nov 8 '08 #1
4 3880
lizaww
6
this is how i found the area of a circle
#include <iostream>

using namespace std;

int main ()
{
float area ,pi, radius;
pi= 3.14;
cout << "Which is the radius of the circle? " << "\n";
cin >> radius;
area= pi*(radius*radius);
cout << "The circle has an area of " << area << "\n";
system ("Pause");
Nov 8 '08 #2
arnaudk
424 256MB
Replace the line "area=.." with the correct formula for the area of a square.
Nov 8 '08 #3
JosAH
11,448 Expert 8TB
Just don't multiply by pi (or any other rude approximation thereof), call your
circle a square and your radius a side.

kind regards,

Jos
Nov 8 '08 #4
lizaww
6
thanks for your help
Nov 8 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Andy Mabbett | last post by:
I have a page: <http://www.westmidlandbirdclub.com/biblio/banbury.htm> which uses a table to indicate the Ordnance Survey (map) grid- squares covered by a certain area. Is there a way to...
4
by: Crirus | last post by:
I have a square picture. I need to draw a circle on it, and everything outside that circle to be set to a certain color, so the image looks framed On other words, I want to crop a circle form a...
1
by: ViRi | last post by:
I am writing my own little video player, using AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlayer, and i want to add stats when in fullscreen. I am able to Draw to it with GDI+, but since...
7
by: Benny Raymond | last post by:
I searched for a couple hours lastnight on example code of how to go about making an item in the System Tray (notification area) not be square. I've found several programs that do this but I can't...
15
by: anand | last post by:
Dear all, I am trying to "find the area under the curve f(x)=sin(x)/x for x=1 to 3" a) Use the trapezoidal rule method. Prove that your trapezoidal rule method is second order accurate...
5
by: ThunderMusic | last post by:
Hi, I'd need to find (or develop) a control of a map (worldwide if possible) where a user can click and drag to select an area by distance from the click point or using a square area (user's...
2
by: wrestling god | last post by:
Hey everyone, kinda struggling with a part of my hw assignment. would anyone know how I could get started.?? here is the question: Graphical Determination of Pi: The full value of pi, which no...
1
by: pieandpeas | last post by:
Hi, i have a page made up of images within a table, set as backgrounds. in front of the different images on the page there is text. How can i hyperlink the area relative to the size of the...
3
by: Chocolade | last post by:
The file logoArea is 512x512 Now all the int variables are the area of the ogi wich is on the right bottom corner. newimage is the image where i want to put the logo inside so in the end when...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.