Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old August 18th, 2012, 02:03 AM
Registered User
 
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
 
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
 
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





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





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