| | |
small and easy problem please help
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2008
Posts: 3
Reputation:
Solved Threads: 0
i'm beginner in c++ and i get a problem
the problem is
error C2065: 'radius' : undeclared identifier
and the program
do you know why ?
and thanks
the problem is
error C2065: 'radius' : undeclared identifier
and the program
C++ Syntax (Toggle Plain Text)
# include <iostream> using namespace std; class circle { public: void setRadius (double r) { [COLOR="Red"][B]-[/B][/COLOR] radius = r; [COLOR="Green"] //here the problem and i don't know why it's keep telling me " undeclared identifier "[/COLOR] } double getRadius() { return radius; } double getdiameter() { return 2 * radius; } double getarea() { return 3.14 * radius * radius; } double getcircumference() { return 3.14 * radius * 2; } private: double raduis; }; int main() { circle candenter; candenter.setRadius (1.5); cout << "Please enter the radius" << candenter.getRadius() << endl; cout << "Circle information using function members:\n" << endl; cout << "Diameter is " << candenter.getdiameter() << endl; cout << "Circumference is " << candenter.getcircumference() << endl; cout << "Area is \n" << candenter.getarea() << endl; cout << "Circle informationusing display function:\n" << endl; return 0; }
and thanks
Last edited by Narue; Oct 30th, 2008 at 5:22 pm. Reason: Added code tags
An error like undeclared variable seems obvious to me.
Unless you are from Mars and don't understand english, this means that a variable is not declared. What I normally do in such cases is declare a variable, in your case radius.
Happy programming!!!
Unless you are from Mars and don't understand english, this means that a variable is not declared. What I normally do in such cases is declare a variable, in your case radius.
Happy programming!!!
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Make love, no war. Cave ab homine unius libri.
Danny
Hey m18 can't you read?
DECLARE the variable radius in your Circle class.
A variable declaration is something like : int a; which declares the variable a to be an integer.
So get yer ya yas out, run like hell and DECLARE that radius variable!!!!!!!
DECLARE the variable radius in your Circle class.
A variable declaration is something like : int a; which declares the variable a to be an integer.
So get yer ya yas out, run like hell and DECLARE that radius variable!!!!!!!
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Make love, no war. Cave ab homine unius libri.
Danny
•
•
Join Date: Sep 2008
Posts: 90
Reputation:
Solved Threads: 12
private:
double raduis;I think you swapped these two letters
Last edited by unbeatable0; Oct 30th, 2008 at 12:37 pm.
![]() |
Similar Threads
- Sony Vaio Fn key problem (USB Devices and other Peripherals)
- Outlook 2003 - Small Text when replying (Windows Software)
- Small catalog problem (PHP)
- reversing number problem. (C)
- Small date problem (ASP)
- REMOTING, .NET has got a problem wit me *smile* (C#)
- MS Sharepoint 2003 problem, client can't access (Windows NT / 2000 / XP)
- Number puzzle help (C)
- how long does it take to learn assembler and how difficult is it? (Assembly)
Other Threads in the C++ Forum
- Previous Thread: C++ Zeller's Algorithm
- Next Thread: CreateProcess help!!!
| Thread Tools | Search this Thread |
api array arrays based binary bitmap c++ c/c++ calculator char char* class code coding compile console conversion count data database delete deploy desktop developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math matrix memory multiple news node number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg sorting string strings temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets







