473,395 Members | 1,526 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,395 software developers and data experts.

Beginner begging: problems with Builder!

I am learning how to use C++ -- I'm using the Borland C++ Builder.

I tried to do the first little "Hello World!" programs in the book.
What is supposed to happen is I type in the code like it shows in the
book, and a DOS window is supposed to pop up when it is done compiling.
What actually happens is . . . nothing. The little window pops up that
says it is compling, and then nothing happens. No DOS window. The title
bar of the window says it is running, but it never stops. I can pause
it, and reset the program, but every time I tell it to run, nothing
happens. I've tried reinstalling the program. I once got an error
message about the BDE, but I didn't see any change. When I close the
program, it says it is in the middle of debugging, which I didn't tell
it to do.

Any insight will be greatly appreciated by this programming noob.

Thanks!

Jun 9 '06 #1
6 1751
Well your program should pretty much just be:

#include <iostream>

int main()
{
cout << "Hello World" << endl;
return 0;
}

and it should be thrown into main.cpp - - Now if you have exactly that
it might be whatever program you are using to compile the code, what
are you using? I would suggest going with Microsoft Visual C++ 2005
Express - - it has everything you need as a beginner you can download
it here:
http://msdn.microsoft.com/vstudio/ex...d/default.aspx
If you download that you are going to want to make a new win32 console
based project, compeletly blank, then you can just add your single
main.cpp file in there with your code and compile it.

Jun 9 '06 #2
* sdavids:
Well your program should pretty much just be:

#include <iostream>

int main()
{
cout << "Hello World" << endl;
return 0;
}


That shouldn't compile.

This is a formally valid hello world in C++:

#include <iostream>
#include <ostream>
int main()
{
std::cout << "Hello, world!" << std::endl;
}

The following is an in-practice valid hello world in C++:

#include <iostream>
int main()
{
using namespace std;
cout << "Hello, world!" << endl;
}

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jun 9 '06 #3
True, I forgot the "using namespace std;" which I usually throw up
right below my #includes. Although you might want to check out Java,
since it seems to be less complicated than C++ since in Java its not as
confusing to manipulate data, like passing by reference and using
pointers and such, plus Java does copy constructors and deconstructors
for you. Since Java does all these things for you it is a slower
programming language than C++ but from what I see a lot of companies
decide to go with Java because of the ease, although some companies
that demand performance like Microsoft strictly use C++. If you want to
play around with Java you can get plenty of tutorials online and you
can get your compiler at www.eclipse.org - IBM makes it, and its pretty
much the Visual Studio equivalent for Java. If you are interested in
the similarities between Java and C++ they are all pretty similar, here
is an example hello world program:

public class Hello {
public static void main(String []args)
{
System.out.println("Hello World!");
}
}

Dont let the class intimidate you, read about 2 chapters in front of
the Hello World program in your book to read about it. Its nice in Java
how you dont need seperate .h and .cpp files to declare / implement all
your code. Have fun!

Jun 9 '06 #4
Alf P. Steinbach <al***@start.no> wrote:
#include <iostream>
#include <ostream>
int main()
{
std::cout << "Hello, world!" << std::endl;
}


All right, I admit I don't know why both <iostream> and <ostream> are
needed here. Care to elaborate?

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Jun 9 '06 #5
Christopher Benson-Manica wrote:
Alf P. Steinbach <al***@start.no> wrote:
#include <iostream>
#include <ostream>
int main()
{
std::cout << "Hello, world!" << std::endl;
}


All right, I admit I don't know why both <iostream> and <ostream> are
needed here. Care to elaborate?


I believe endl is technically only in ostream.
Jun 9 '06 #6
Christopher Benson-Manica <at***@otaku.freeshell.org> wrote:
Alf P. Steinbach <al***@start.no> wrote:
#include <iostream>
#include <ostream>
int main()
{
std::cout << "Hello, world!" << std::endl;
}


All right, I admit I don't know why both <iostream> and <ostream> are
needed here. Care to elaborate?


<ostream> is needed for std::endl, however, in practice most
implementations I know of (with the exception of aCC on HP-UX) will let
you get away with just <iostream>.

There is somewhat of a discussion at
http://en.wikipedia.org/wiki/Talk:C+...C_and_all_that...

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
Jun 9 '06 #7

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

Similar topics

3
by: Art | last post by:
NEWBIE ALERT! Esteemed List Participants and Lurkers: (System: P-II 350, 192 meg, Win98 SE, Python 2.2.3, wxPythonWIN32-2.4.1.2-Py22.exe) I'm having a lot of fun getting started with Python...
1
by: Peter Morris | last post by:
Hi, folks. I'm just learning ASP programming in C# using Borland C# Builder I'm having problems, which I think are some sort of configuration issue, with .NET framework or IIS. I'm using XP...
2
by: Andrew | last post by:
I am having some problems with JDOM in Builder 9 version. I ve actually used all the latest JDOM libraries but it seems that the RunTime environment keeps giving me JDOMExceptions whetever I do. ...
44
by: lester | last post by:
a pre-beginner's question: what is the pros and cons of .net, compared to ++ I am wondering what can I get if I continue to learn C# after I have learned C --> C++ --> C# ?? I think there...
7
by: Rensjuh | last post by:
Hello, does someone have / know a good C++ tutorial for beginnners? I would prefer Dutch, but English is also fine. Hoi, heeft / kent iemand nog een goede C++ tutorial voor beginners? Het liefste...
3
by: Rhino | last post by:
I've spent the last couple of hours trying to figure out how to debug a Java stored procedure and am just going in circles. The last straw came when I got "Cannot open input stream for default"...
0
by: Billie Boy | last post by:
Hi to all. I’m new here and am coming to you from Melbourne Australia. So a big HELLO 2 ALL. Now I am encountering an annoying problem in the SQL builder of the copy of VB.6 that I am using at...
0
by: Leite33 | last post by:
Hello I am rookie in learning C++ Builder 6. I try to make an application for storing data and especially pictures. So i try to connect C++Builder 6 and Microsoft SQL Server 2000. I use 4 C++...
1
by: jl2886 | last post by:
I am just beginning to learn access for my job. I have created a table that contains certain variables and then created a form for those variables. I want some of the variables to be dependent on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.