Skip to content
This repository has been archived by the owner on Jan 1, 2019. It is now read-only.

Commit

Permalink
Merge pull request #67 from DrunkenLord/master
Browse files Browse the repository at this point in the history
Other simple programs on Language D and a instruction file.
  • Loading branch information
srbcheema1 authored Oct 2, 2017
2 parents 53ef68b + bc67006 commit 807068d
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 0 deletions.
29 changes: 29 additions & 0 deletions D/Instructions
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
To run your program in D you should do the following things: -
1. Download the D compiler form the internet
2. Run the program as follows.

On windows: -
Now we can build and run a d file say helloWorld.d by switching to folder containing the file using cd and then using the following steps −

C:\DProgramming> DMD helloWorld.d
C:\DProgramming> helloWorld
We can see the following output.

hello world


On ubuntu: -
Now we can build and run a d file say helloWorld.d by switching to folder containing the file using cd and then using the following steps −

$ dmd helloWorld.d
$ ./helloWorld
We can see the following output.

$ hello world


On Mac OS X: -
Similar to ubuntu.


3.
6 changes: 6 additions & 0 deletions D/Strings.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import std.stdio;

/* My first program in D */
void main(string[] args) {
writeln("test!");
}
26 changes: 26 additions & 0 deletions D/Variables.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import std.stdio;

int a = 10, b = 10;
int c;
float f;

int main () {
writeln("Value of a is : ", a);

/* variable re definition: */
int a, b;
int c;
float f;

/* Initialization */
a = 30;
b = 40;
writeln("Value of a is : ", a);

c = a + b;
writeln("Value of c is : ", c);

f = 70.0/3.0;
writeln("Value of f is : ", f);
return 0;
}
File renamed without changes.
9 changes: 9 additions & 0 deletions D/loops.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
mport std.stdio;

int main () {

for( ; ; ) {
writefln("This loop will run forever.");
}
return 0;
}

0 comments on commit 807068d

Please sign in to comment.