the future comes from Microsoft, greet Windows with cheers.
#include <iostream.h>
int a=10;
int b=10;
int c=0;
int d=0;
void main(void)
{
c = b++;
cout << "b:" << b << " c:" << c << '\n';
d = --a;
cout << "a:" << a << " d:" << d << '\n';
}
include "window.h"
def color 0xFFC8C8
setwindow "Prefix/Postfix",640,480,ws_overlapped
setfont 16,22,0,0
sys a=10,b=10,c,d
c = b: b = b+1
settext "b:" + b + " c:" + c,32,32,color
a = a-1
d = a
settext "a:" + a + " d:" + d,32,64,color
waitkey(vk_space)
winend
#include <iostream.h>
void output(int x);
void output(char c);
void output(float f,char c);
void main(void)
{
int intvar = 10;
char Character = 'Z';
float fvar = 11.11f;
output(character);
output(intvar);
output(fvar,Character);
}
void output(int x)
{
cout << x << '\n';
}
void output(char c)
{
cout << c << '\n';
}
void output(float f, char c)
{
cout << f << " " << c << '\n';
}
I know about D but I have not been tempted to investigate yet. Is there any thing useful we could add to Oxygen?
#!/usr/bin/dmd -run
/* sh style script syntax is supported */
/* Hello World in D
To compile:
dmd hello.d
or to optimize:
dmd -O -inline -release hello.d
*/
import std.stdio;
void main(string[] args)
{
writeln("Hello World, Reloaded");
// auto type inference and built-in foreach
foreach (argc, argv; args)
{
// Object Oriented Programming
auto cl = new CmdLin(argc, argv);
// Improved typesafe printf
writeln(cl.argnum, cl.suffix, " arg: ", cl.argv);
// Automatic or explicit memory management
delete cl;
}
// Nested structs and classes
struct specs
{
// all members automatically initialized
size_t count, allocated;
}
// Nested functions can refer to outer
// variables like args
specs argspecs()
{
specs* s = new specs;
// no need for '->'
s.count = args.length; // get length of array with .length
s.allocated = typeof(args).sizeof; // built-in native type properties
foreach (argv; args)
s.allocated += argv.length * typeof(argv[0]).sizeof;
return *s;
}
// built-in string and common string operations
writefln("argc = %d, " ~ "allocated = %d",
argspecs().count, argspecs().allocated);
}
class CmdLin
{
private size_t _argc;
private string _argv;
public:
this(size_t argc, string argv) // constructor
{
_argc = argc;
_argv = argv;
}
size_t argnum()
{
return _argc + 1;
}
string argv()
{
return _argv;
}
string suffix()
{
string suffix = "th";
switch (_argc)
{
case 0:
suffix = "st";
break;
case 1:
suffix = "nd";
break;
case 2:
suffix = "rd";
break;
default:
break;
}
return suffix;
}
}
There isn't much difference between building 32 bit or 64 bit executables. The language in large degree insulates you from the differences.