473,407 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Compiler errors

When I run the following code through my compiler, I get C2065 and C2145
errors. Can someone help?
#include <iostream>
using namespace std;
int main ()
{
//declare variables
double dblin;
int intout;

//requesting a number
cout << "Enter a decimal number to round: ";

//user input
cin >> dblin;
cout << endl;

//round the number
intout = dblin;

//output the rounded number
cout << "The number rounded is ";
cout << intout;
cout << endl;

round 0;

}
Sep 5 '05 #1
6 1989
deanfamily11 wrote:
When I run the following code through my compiler, I get C2065 and C2145
errors. Can someone help?

See below.

#include <iostream>
using namespace std;
int main ()
{
//declare variables
double dblin;
int intout;

//requesting a number
cout << "Enter a decimal number to round: ";

//user input
cin >> dblin;
cout << endl;

//round the number
intout = dblin;

//output the rounded number
cout << "The number rounded is ";
cout << intout;
cout << endl;

round 0;

Should be

return 0;

Try reading the error messages next time, I got

error C2065: 'round' : undeclared identifier

Seems pretty clear to me.

john
}

Sep 5 '05 #2
I had read that, but didn't think to look down at the end. It's been awhile
since I did any C++ coding. Thanks for the help.

"John Harrison" <jo*************@hotmail.com> wrote in message
news:MJ*****************@newsfe1-gui.ntli.net...
deanfamily11 wrote:
When I run the following code through my compiler, I get C2065 and C2145
errors. Can someone help?


See below.

#include <iostream>
using namespace std;
int main ()
{
//declare variables
double dblin;
int intout;

//requesting a number
cout << "Enter a decimal number to round: ";

//user input
cin >> dblin;
cout << endl;

//round the number
intout = dblin;

//output the rounded number
cout << "The number rounded is ";
cout << intout;
cout << endl;

round 0;


Should be

return 0;

Try reading the error messages next time, I got

error C2065: 'round' : undeclared identifier

Seems pretty clear to me.

john
}

Sep 5 '05 #3
deanfamily11 wrote:
I had read that, but didn't think to look down at the end. It's been awhile
since I did any C++ coding. Thanks for the help.


If you double click on the error message it takes you to the line that
caused the error.

john
Sep 5 '05 #4
To correct this error,

either, replace the 'round 0;' to 'return 0;' or,
change the 'int main ()' to 'void main()' and remove the 'return 0;'

deanfamily11 wrote:
When I run the following code through my compiler, I get C2065 and C2145
errors. Can someone help?
#include <iostream>
using namespace std;
int main ()
{
//declare variables
double dblin;
int intout;

//requesting a number
cout << "Enter a decimal number to round: ";

//user input
cin >> dblin;
cout << endl;

//round the number
intout = dblin;

//output the rounded number
cout << "The number rounded is ";
cout << intout;
cout << endl;

round 0;

}


Sep 6 '05 #5
pk_prashant wrote:
To correct this error,

either, replace the 'round 0;' to 'return 0;' or,
change the 'int main ()' to 'void main()' and remove the 'return 0;'


WRONG!

it's ALWAYS 'int main()' or 'int main(int argc, char* argv[])' and
NEVER EVER 'void main()'

So, the fix would be to change 'round 0;' to 'return 0;' or remove that line
completely.
/S.
Sep 6 '05 #6

"deanfamily11" <de**********@verizon.net> wrote in message
news:sF1Te.16296$Sx4.12121@trnddc06...
When I run the following code through my compiler, I get C2065 and C2145
errors. Can someone help?


Please don't assume that, because your compiler reports those error codes,
everyone else's will also. Compilers differ on how they report errors.
There are no "standard" error codes. Indeed, there is no reason to even
assume that any "error code" at all is reported. You may only see text as
output from the compile attempt, such as "Syntax error, line16: ';' expected
here", or something similar. To most of us, "C2065" has no meaning
whatsoever. It's the text that tells us what is wrong, not some obscure
code.

Next time, let us know the text associated with the error code, not the
error code itself.

(Also, please place your replies _after_ the text to which you are replying,
not at the top. That's the standard for usenet postings.)

-Howard
Sep 6 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: jon morgan | last post by:
OK, I'm going to be brave. There is a bug in VS.Net 1.1 that causes random compiler errors. I have raised this issue in posts at least three time in the past couple of months without attracting...
30
by: Neil Zanella | last post by:
Hello, Allow me to share my frustrations with GNU g++. This is the second time something similar happens to me: I can't find anything wrong with my C++ program and yet I get segfaults, and...
10
by: Bjorn | last post by:
I'm using interfaces in C++ by declaring classes with only pure virtual methods. If then someone wants to implement the interface they needs to inherit from the class. If the implementing class...
2
by: Mary | last post by:
Hello, I am having a problem with the cl compiler. I have written a C class (RegConnect.c) which uses Win32 API functions such as RegOpenKey, RegCloseKey etc. Initially when I was trying to...
16
by: pj | last post by:
(Was originally, probably wrongly, posted to the vc subgroup.) (This doesn't appear to be a c# problem, but a problem with a bug in the Visual Studio c# compiler, but, any help will be welcome...)...
6
by: David Lack | last post by:
Hi, I recently installed a 60-day trial of .NET 2003 on my development system. I made tests with previous personal projects (which compiled ok with VC6) and some open source files, and keep...
2
by: Samuel R. Neff | last post by:
Within the past few weeks we've been getting a lot of compiler errors in two classes when no errors actually exist. The error always reports as Name '_stepResizeRelocator' is not declared. ...
1
by: Peter Wilson | last post by:
I am running a VB.Net conversion project and have run into a severe problem compiling the application. The project has a main project with about one hundreds forms. (Did I say badly structured?) ...
14
by: 2005 | last post by:
Would it suppress errors? Is he trying to hide errors in his code?
8
by: =?GB2312?B?yum09MXt?= | last post by:
today I forgot to include some header,then I found the error message by the compiler is quite strange. so I want to know exactly the inner details of the compiler impletation,if possible. and I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
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...

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.