Board index » cppbuilder » "Hello World"

"Hello World"


2005-12-26 08:02:11 AM
cppbuilder25
This will probably seem like a ridiculous question, but...
My son is taking C++ in High School right now. He said he is using the
Borland C++ compiler and wanted the compiler for Christmas. I got it
through the Academic Superstore. We did the install, but he says the
interface is not familiar. On looking closer, I got C++ Builder. The
Builder looks like a way way way overkill program for a kid that is learning
C++. He says they have a user interface where he can do editing and
compiling. The free C++ compiler from Borland is a command line version,
and is also not the right one.
I have looked and it doesn't look as though Borland makes another C++
compiler. Does anyone know what I should have ordered? Is it possible that
the Builder is what I want, just not configured properly?
We can't even get the "hello world" program to compile. It kicks out a
bizillion errors on such a simple program, and it looks like it is putting a
bunch of code in the background.
Any thoughts?
Thanks
Steve Fong
XXXX@XXXXX.COM
 
 

Re:"Hello World"

On Mon, 26 Dec 2005 00:02:11 GMT, "sfong" < XXXX@XXXXX.COM >wrote:
Dear Steve Fong,
Assuming you have C++ Builder then:
1) Start a new project [menu File - New - Other - 'Console Wizard] or
use Ctl- N.
2) You see a 'Console Wizard' Dialog - select Source Type C++, and
make sure the Console Application is ticked, click OK (Simple programs
that do NOT use the Windows API or GUI elements etc are refered to as
Console Applications).
3) You should be presented with an editing window with a tab
'Unit1.cpp' and a function body called main. Edit this until is looks
like the following:
#include <stdio.h>
int main(int argc, char* argv[])
{
printf("hello steve\n");
return 0;
}
4) Click Build (F7) or Make (Ctl+F7). BCB will present you a dialog
for you to save the project files. You should decide where your
projects are saved eg c:\prjects\, or maybe a dir under the BCB
projects dir presented eg create a subdir called hello. Then enter
hello.cpp instead of unit1.cpp and hello.bpr instead of project1.bpr.
5) BCB will save your project files and then compile. Assuming there
are no errors you can Run (F5) the hello program.
6) In this case you will see a console / 'dos box' open and quickly
close. That's it, as your program runs and terminates without any
user interevention.
7) From the Windows Start Icon click Run and enter command (Windows 98
etc) or cmd (NT, 2000, XP);
8) cd to the dir where you saved the project eg
cd "\Program Files\Borland\CBuilder6\Projects\hello"
9) Enter hello and you should see 'hello steve'
10) If you want a bit more interaction try:
#include <stdio.h>
int main(int argc, char* argv[])
{
char name [128];
printf("hello, whats you name?: ");
scanf ("%s", &name);
printf("hello %s\n", name);
return 0;
}
11) Now read the manual(s) !!
Reddog.
 

Re:"Hello World"

Quote
I have looked and it doesn't look as though Borland makes
another C++ compiler.
They might be using the much older Borland Turbo C++ compiler.
Quote
Any thoughts?
My suggestion would be to use the command line compiler
version and use a make file to run the compile and link:
www.zeusedit.com/forum/viewtopic.php
IMHO make files are not difficult to learn and once mastered
they result in a much better programmer as they illustrate
clearly all the steps involved in creating an executable.
Just remember to put the Borland installation bin directory
into the PATH environment variable.
Jussi Jumppanen
Author: Zeus for Windows
www.zeusedit.com
 

{smallsort}

Re:"Hello World"

Thanks for the great and extensive response Red Dog...
I think this might just do it.
Hopefully you have just rescued this gift!
Steve
"Reddog" < XXXX@XXXXX.COM >wrote in message
Quote
On Mon, 26 Dec 2005 00:02:11 GMT, "sfong" < XXXX@XXXXX.COM >wrote:

Dear Steve Fong,

Assuming you have C++ Builder then:

1) Start a new project [menu File - New - Other - 'Console Wizard] or
use Ctl- N.

2) You see a 'Console Wizard' Dialog - select Source Type C++, and
make sure the Console Application is ticked, click OK (Simple programs
that do NOT use the Windows API or GUI elements etc are refered to as
Console Applications).

3) You should be presented with an editing window with a tab
'Unit1.cpp' and a function body called main. Edit this until is looks
like the following:

#include <stdio.h>
int main(int argc, char* argv[])
{
printf("hello steve\n");
return 0;
}

4) Click Build (F7) or Make (Ctl+F7). BCB will present you a dialog
for you to save the project files. You should decide where your
projects are saved eg c:\prjects\, or maybe a dir under the BCB
projects dir presented eg create a subdir called hello. Then enter
hello.cpp instead of unit1.cpp and hello.bpr instead of project1.bpr.

5) BCB will save your project files and then compile. Assuming there
are no errors you can Run (F5) the hello program.

6) In this case you will see a console / 'dos box' open and quickly
close. That's it, as your program runs and terminates without any
user interevention.

7) From the Windows Start Icon click Run and enter command (Windows 98
etc) or cmd (NT, 2000, XP);
8) cd to the dir where you saved the project eg
cd "\Program Files\Borland\CBuilder6\Projects\hello"
9) Enter hello and you should see 'hello steve'
10) If you want a bit more interaction try:

#include <stdio.h>

int main(int argc, char* argv[])
{
char name [128];
printf("hello, whats you name?: ");
scanf ("%s", &name);
printf("hello %s\n", name);
return 0;
}

11) Now read the manual(s) !!

Reddog.

 

Re:"Hello World"

i am new-comer in c++ and programing general.I have download borland
turbo c++ and i try to run "hello world" but nothing!!! does anyone
knows the procedure to run and "see" the results of simple programs
like "hello world" in turbo c++.thanks