Valhalla Legends Forums Archive | C/C++ Programming | New to C++

AuthorMessageTime
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)

[color=Red]
Assuming that you are able to work an editor and can enter a script and create
a file. Please enter[/color]  [color=Purple](where?)[/color] [color=Red]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:[/color][color=Purple](where?)[/color]

[color=Red]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:[/color] [color=Purple](Where?)[/color]

[color=Red]hello

Lo and behold the computer will print

Hello World...[/color]

Now I can comprehend if only I knew where to enter it. Can someone help?
October 15, 2004, 4:42 PM
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.
October 15, 2004, 7:29 PM

Search