473,508 Members | 2,130 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I keep getting syntax error that my coding is wrong...please help me ASAP!!!

1 New Member
Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. using namespace std;
  3. void getLength();
  4. void getWidth();
  5. void getArea();
  6. void getdisplayData();
  7. int main()
  8. {
  9. // Get the rectangle's length.
  10. {
  11. double length;
  12. cout << "What is the rectangles length? ";
  13. cin >> length;
  14. // Get rectangles width.
  15. cout << "What is the rectangles width? ";
  16. cin >> width;
  17. }
  18. // Display the rectangle's data.
  19. {
  20. getdiplayData(getLength,getWidth, getArea);
  21. cout << "length = " << endl;
  22. cout << "width = " << endl;
  23. cout << "area = " << endl;
  24. }
  25. }
  26. return 0;
Oct 7 '13 #1
1 1321
Banfa
9,065 Recognized Expert Moderator Expert
You have the basic structure of your functions wrong, functions can not be defined inside other functions a program calling 1 function might look something like this

Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void getLength();
  6.  
  7. int main()
  8. {
  9.   cout << "Main Entered" << endl;
  10.  
  11.   getLength();
  12.  
  13.   cout << "Back in Main, exiting now" << endl;
  14.  
  15.   return 0;
  16. }
  17.  
  18. void getLength()
  19. {
  20.   cout << "getLength called" << endl;
  21. }
  22.  
Oct 7 '13 #2

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

Similar topics

3
1461
by: Franko | last post by:
I get the following error. Ihave no idea why? Pl help Server Error in '/WebApplication1' Application. -------------------------------------------------------------------------------- Compilation...
2
2103
by: David Hearn | last post by:
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Description: An unhandled exception occurred during the execution of the current...
2
9278
by: Roy Rodsson via .NET 247 | last post by:
Hi all! I am using a stored procedure in SQL2000 for retrieving fileinformations from a db. the table as an uniqueidentifier for the file information. The stored procedure has a variable...
3
1779
by: rich | last post by:
I keep getting the error: Warning: in_array(): Wrong datatype for second argument on line 679 here is the code. I declare and fill the array $specprimA = array(); $specprimA=...
8
3672
by: Michael Press | last post by:
I have not written python codes nor run any. I saw this code posted and decided to try it. It fails. I read the tutorial and the entry for the built in function sum, but still do not see the...
18
3759
by: rahuls | last post by:
Hi everyone, I have a couple of questions? 1.this is part of my main function ////////////////////////////// int main() { FILE *f1; int i,j; j=100000000; int intData;
7
2831
by: Yesurbius | last post by:
I am receiving the following error when attempting to run my query. In my mind - this error should not be happening - its a straight-forward query with a subquery. I am using Access 2003 with all...
7
14084
by: nhatto | last post by:
Hello I have Two Tables ( Table A and Table B) Table A has one field : email Table B has three Fields : First name, Last name , email I want to check if the email in Table B is found in...
5
2151
by: hpailles | last post by:
I keep getting this error, could somebody help? <?php if ((!$_POST) || (isset($_GET)){ //haven't seen the form, so show it $display_block = " <form method=\"post\"...
0
1421
by: dougancil | last post by:
I have the following code: Imports System.Data.SqlClient Public Class Main Protected WithEvents DataGridView1 As DataGridView Dim instForm2 As New Exceptions Private Sub...
0
7225
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
7123
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
7326
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,...
1
7046
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
7498
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5627
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,...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4707
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
418
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.