| View previous topic :: View next topic |
| Author |
Message |
Haruhi Suzumiya. Master Cheater
Reputation: 1
Joined: 05 Feb 2005 Posts: 463
|
Posted: Tue May 26, 2009 6:14 pm Post subject: Trying to make a calculator but keep getting a error |
|
|
| 6 C:\Documents and Settings\user\My Documents\calculator.cpp `end1' undeclared (first use this function) . I am a big noob so explain to me what the problem is.
|
|
| Back to top |
|
 |
manc Grandmaster Cheater
Reputation: 1
Joined: 16 Jun 2006 Posts: 551
|
Posted: Tue May 26, 2009 6:24 pm Post subject: |
|
|
It means that end1 is undeclared or undefined...in line 6.
So declare end1 before you try to use it in line 6.
example, int end1;
(if you want to use it to store numbers, that is)
_________________
|
|
| Back to top |
|
 |
Scathe I post too much
Reputation: 0
Joined: 02 Aug 2006 Posts: 3631 Location: Smoking a blunt
|
Posted: Tue May 26, 2009 6:26 pm Post subject: |
|
|
You didnt declare whatever end1 is.
Unless you mistook endl; as end1;
its an L, not a number.
endl is short for end-line, which tells the compiler you're starting a new line.
example:
| Code: |
cout<<"This is a line!"<<endl;
cout<<"This is another line!";
|
Will output:
This is a line!
This is another line!
However this:
| Code: |
cout<<"This is a line!";
cout<<"This is another line";
|
Will output:
"This is a line!This is another line"
Hope that helps...unless you really made a variable called end1, then you didnt declare it correctly, but im 90% sure you just read your book wrong.
Edit:
Incase i am wrong.
Correct variable declarations:
type variable name
int end1
And if you want to instantiate it, just set it = to something.
e.g:
int end1 = 0;
_________________
<Moose> they will call me beard penis |
|
| Back to top |
|
 |
Haruhi Suzumiya. Master Cheater
Reputation: 1
Joined: 05 Feb 2005 Posts: 463
|
Posted: Tue May 26, 2009 6:40 pm Post subject: |
|
|
| Scathe wrote: | You didnt declare whatever end1 is.
Unless you mistook endl; as end1;
its an L, not a number.
endl is short for end-line, which tells the compiler you're starting a new line.
example:
| Code: |
cout<<"This is a line!"<<endl;
cout<<"This is another line!";
|
Will output:
This is a line!
This is another line!
However this:
| Code: |
cout<<"This is a line!";
cout<<"This is another line";
|
Will output:
"This is a line!This is another line"
Hope that helps...unless you really made a variable called end1, then you didnt declare it correctly, but im 90% sure you just read your book wrong.
Edit:
Incase i am wrong.
Correct variable declarations:
type variable name
int end1
And if you want to instantiate it, just set it = to something.
e.g:
int end1 = 0; | There's the problem! I put a 1 instead of a l T_T. Thank you!
|
|
| Back to top |
|
 |
|