473,493 Members | 2,274 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Variable Manipulation

4 New Member
Hi guys, I am new to C++ and I am starting to learn the basics of it. I am doing my own little assignment and I was wondering if you could help?


Heres my source code:

Expand|Select|Wrap|Line Numbers
  1. // Casey's Wire Fence Calculator
  2.  
  3. #include <iostream>
  4.  
  5.  
  6. using std::cout;
  7. using std::endl;
  8. using std::cin;
  9.  
  10.  
  11. int main()
  12. {
  13.     cout << "Casey's Wire Fence Calculator" << endl;
  14.  
  15.     float rectangleLength = 0.0, rectangleWidth = 0.0, rectanglePerimeter = 0.0, wireCost = 0.0, totalCost = 0.0;
  16.  
  17.     // get the length and width values from the user
  18.     cout << "Please enter the rectangle length ";
  19.     cin >> rectangleLength;
  20.  
  21.     cout << "Please enter the rectangle width ";
  22.     cin >> rectangleWidth;
  23.  
  24.     // Perimeter of a rectangle is LxWxLxW = P
  25.  
  26.     rectanglePerimeter =(2*(rectangleLength * rectangleWidth));
  27.  
  28.     cout << " The rectangle perimeter is ";
  29.     cout << rectanglePerimeter << endl;
  30.  
  31.     cout << endl;
  32.  
  33.     cout << "Please enter the cost per metre of wire ";
  34.     cin >> wireCost;
  35.  
  36.  
  37.     return 0;
  38. }
  39. // end of main() function
  40.  
I need help because I know how to multiply two variables together but, I want to multiply another two variables together and then multiply the two answers to the two equations I have done. How do I go about that?

Thanks Casey :)
Mar 28 '07 #1
2 1302
Ganon11
3,652 Recognized Expert Specialist
What exactly do you mean? The sample program you've written looks very good so far - what else do you need to do?
Mar 28 '07 #2
RedSon
5,000 Recognized Expert Expert
Also per the posting guidelines your thread title is unacceptable. Please read the FAQ located in the Tabs above and pay particular attention to this.
Mar 28 '07 #3

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

Similar topics

2
1765
by: washu | last post by:
Hi, This may be a simple problem but I can't seem to find a way around it. I've pasted my code snippet below: import os input = os.popen("echo hello") input.readline() input.readline()
3
2515
by: Jason | last post by:
From previous postings I have read it seems that I cannot create a function that accepts a variable list of parameters. Seems that SQL Server does not support this. A few questions: Is this...
9
2577
by: I. Kobrinsky | last post by:
I'm new here. I started a personal password-program, a trial that includes username, logincounter and password. So my intention is to hide pwd while tipping. So I'm thinking about two popular...
2
2403
by: Daniel Reardon | last post by:
All, I'm sure that this is an old question, but I'm having problems getting a substring of a passed in variable. I can do other string manipulation with it such as concatonation, but I'm really...
2
1134
by: =?Utf-8?B?QW5keQ==?= | last post by:
Hello, I'm trying to create a C++ command line program that will extract specific lines from a text file and write them to another text file. E.g. If I want the program to look for the word...
3
2709
by: ali | last post by:
Hi, When I pass a pointer as an argument of a method, is it safe if I change the data pointed by the argument and return it upon completion ? For example: Object* someFunction(Object* ob)...
0
2562
by: L'eau Prosper Research | last post by:
Press Release: L'eau Prosper Research (Website: http://www.leauprosper.com) releases new TradeStation 8 Add-on - L'eau Prosper Market Manipulation Profiling Tools Set. L'eau Prosper Market...
0
2335
by: L'eau Prosper Research | last post by:
NEW TradeStation 8 Add-on - L'eau Prosper Market Manipulation Profiling Tools Set By L'eau Prosper Research Press Release: L'eau Prosper Research (Website: http://www.leauprosper.com) releases...
11
21615
by: EricGoogle | last post by:
Hello All, I am trying to figure out a how to get a variable's name from code. Ex: var MYVAR = 3; alert( ????? ); OUTPUT: "MYVAR"
2
2190
by: sh.vipin | last post by:
Below is a piece of bit manipulation code. here in function "eval_output_out" there are some macros. Say we have to versions of the same code 1. variable "b" in "eval_output_out" is initialized...
0
7119
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
6989
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7157
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
7195
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...
1
6873
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...
0
5453
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4579
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3088
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
285
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.