• Welcome to Valhalla Legends Archive.
 

New to C++

Started by StAiN, October 15, 2004, 11:42 AM

Previous topic - Next topic

StAiN

I am currently reading a tutorial, and I'm on Chapter 2... It gave me some code to put... somewhere. I'm not sure exactly where to though. I'm sorta confused it didn't give me anything to work with.. Or in other words didn't tell me where to go. This is what its telling me: (Tutorial = Red) (Questions = Purple)


Assuming that you are able to work an editor and can enter a script and create
a file. Please enter
  (where?) the following tiny program.

#ident "@(#) Hello World - my first program"

#include <stdio.h>

char *format = "%s",
     *hello = "Hello World...\n";

main()
{
  printf ( format, hello );
  }

Now save it in a file called hello.c. Lower case is allowed - encouraged, no
less - under the UNIX operating system.

Now type:
(where?)

cc -o hello hello.c

The computer will apparently pause for a few moments and then the
Shell, or Command Line Interpreter prompt will re-appear.

Now type:
(Where?)

hello

Lo and behold the computer will print

Hello World...


Now I can comprehend if only I knew where to enter it. Can someone help?

Yoni

The code should be saved in a file called hello.c.
The commands cc -o hello hello.c and hello should be entered in a command shell.