Give an example of cpp progrm in knoppix, a linux flavor.
Pleas explain..
Compiling
viewing out put
Pleas explain..
Compiling
viewing out put
[color=#BC7A00]#include <iostream> [/color][color=#408080][i]// No .h's for standard libraries anymore
[/i][/color]
[color=#008000][b]using[/b][/color] [color=#008000][b]namespace[/b][/color] std;
[color=#408080][i]// All the standard headers use this namespace,
// so lets make it common.
// Else we type std::cout and std::endl, and so on.
// Just think of it as,
// cout, endl, cin, etc default functions
// belong to this large class
// (actually name-space) called [B]std[/B] (standard).
[/i][/color]
[color=#B00040]int[/color] main () [color=#408080][i]// main must always return int now on ...
[/i][/color]{
cout[color=#666666]<<[/color][color=#BA2121]"Hello"[/color][color=#666666]<<[/color][color=#BA2121]" "[/color][color=#666666]<<[/color][color=#BA2121]"World"[/color][color=#666666]<<[/color]endl;
[color=#008000][b]return[/b][/color] [color=#666666]0[/color];
}
[color=#408080][i]// Save as file.cpp[/i][/color]
[color=#408080][i]# Use g++, the default GNU C++ compiler.
[/i][/color]g++ file.cpp -o outfile
[color=#408080][i]# Outfile is the output (binary, executable) file name. By default it is a.out (Assembler.output)
[/i][/color]
./outfile [color=#408080][i]# or use: sh outfile[/i][/color]