Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 18th, 2012, 02:03 AM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy plz help me where my code is wrong?

//define constants: calculate circumference

#include<iostream>
#include<conio>
using namespace std;

#define PI 3.14159
#define NEWLINE '\n'

int main()
{
double r = 5.0; //radius
double circle;

circle = 2*PI*r;
cout << circle;
cout << NEWLINE;

return 0;
getch ();

}



I''m new to programming, In the above code line 20 D:\Dev-Cpp\bin\Tests\circle_circumference1.cpp `getch' undeclared (first use this function)
I do not understand .....what is the error? Plz help me
Reply With Quote
  #2 (permalink)  
Old August 27th, 2012, 06:31 PM
Registered User
Points: 9, Level: 1
Points: 9, Level: 1 Points: 9, Level: 1 Points: 9, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It looks like you have a space between "getch" and "()"
Reply With Quote
  #3 (permalink)  
Old September 11th, 2012, 04:54 AM
mbatra
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by pgmr_prantik View Post
//define constants: calculate circumference

#include<iostream>
#include<conio>
using namespace std;

#define PI 3.14159
#define NEWLINE '\n'

int main()
{
double r = 5.0; //radius
double circle;

circle = 2*PI*r;
cout << circle;
cout << NEWLINE;

return 0;
getch ();

}



I''m new to programming, In the above code line 20 D:\Dev-Cpp\bin\Tests\circle_circumference1.cpp `getch' undeclared (first use this function)
I do not understand .....what is the error? Plz help me

Hi,

its not an issue with the space between getch and (). You should use getch() before return 0;

getch();
return 0;

because return 0 means that your program is returing from here. It will never reach getch();


Regards,
mbatra
Reply With Quote
The Following User Says Thank You to For This Useful Post:
  #4 (permalink)  
Old October 5th, 2012, 06:09 AM
Registered User
Points: 9, Level: 1
Points: 9, Level: 1 Points: 9, Level: 1 Points: 9, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

pgmr_prantik, I guess you should correct both the errors as explained by terry and mbatra. Perhaps it will correct the issue.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
plz somebody help me to understand these code........ skbishi BOOK: Beginning Android Application Development 1 September 1st, 2011 04:25 PM
There is something wrong in my code? Cade_Feng BOOK: Professional C# 2008 ISBN: 978-0-470-19137-8 3 March 4th, 2011 02:17 AM
Plz help me with this code hhas Beginning VB 6 5 May 26th, 2010 08:45 AM
What's wrong with this code? appleseed C++ Programming 2 November 25th, 2006 08:17 AM
Plz Help Me Check What's Wrong Of This Code ! ck C++ Programming 1 January 13th, 2005 12:12 AM



All times are GMT -4. The time now is 08:27 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.