Skip to content

Instantly share code, notes, and snippets.

View nikAizuddin's full-sized avatar
⚠️
s t a t i c

Nik Mohamad Aizuddin nikAizuddin

⚠️
s t a t i c
View GitHub Profile
function [T] = test()
%Arrival Time
A = [ 2.17, 7.90, 15.00, 15.17, 15.73,...
18.74, 19.86, 22.51, 23.70, 31.06];
%Begin service
W = [0 0 0 0 0 0 0 0 0 0];
%Service Time
S = [0.10, 4.46, 3.25, 2.26, 4.12, 0.69, 0.77, 3.48, 0.26, 0.41];
@nikAizuddin
nikAizuddin / Example how to read "Hello World" from stdin (C, Win32)
Last active August 29, 2015 14:08
Shows how to read a string that have "space" character.
/*=====================================================================
+-------------------------------------------------------------------+
| |
| Example how to read "Hello World" from stdin |
| |
| The main problem with scanf() is it unable to read properly |
| a string that have "space" character. |
| |
| This example will show how to read a string that have "space" |
| character. |
@nikAizuddin
nikAizuddin / function_example.c
Created November 10, 2014 18:58
Example how to use function
#include <stdio.h>
#include <stdlib.h>
/********************* price_after_discount() ***********************
* Find the price of an item after the discount
*
* @argument1: price = item price.
* @argument2: discount = percentage of discount.
*
* @return: item price after discount
@nikAizuddin
nikAizuddin / How the GNU GCC compiler calculate the equation: x + ++y - x * ++x - --y
Last active August 29, 2015 14:09
x + ++y - x * ++x - --y = -5 ? or = -6 ? Why = -6 ?
How the GNU GCC compiler calculate the equation:
x + ++y - x * ++x - --y
The algorithm used when perform this computation may be different across
compilers. This program is compiled using compiler GNU GCC 4.8.3 built for
Red Hat 4.8.3-7. Tools that are used to reverse engineer or disassemble
this program are "objdump" and "GNU GDB debugger".
The program will solve the following problem:
x + ++y - x * ++x - --y
@nikAizuddin
nikAizuddin / Disassemble C z = ++x + ++x + ++x;
Last active August 29, 2015 14:09
How C execute z = ++x + ++x + ++x;
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int x = 2;
int z = 0;
z = ++x + ++x + ++x;
@nikAizuddin
nikAizuddin / Disassemble Java z = ++x + ++x + ++x
Created November 12, 2014 10:14
How Java execute z = ++x + ++x + ++x
class test {
public static void main(String[] args) {
int x = 2;
int z = 0;
z = ++x + ++x + ++x;
System.out.printf("z = %d\n",z);
}
}
@nikAizuddin
nikAizuddin / Calculate age
Created November 12, 2014 16:06
Programming Technique 2014/2015 Semester 1 Labsheet 4
/*--------------------------------------------------------------------
| TITLE: Calculate age
+--------------------------------------------------------------------
| AUTHOR: Nik Mohamad Aizuddin b. Nik Azmi
| EMAIL: nickaizuddin93@gmail.com
| DATE CREATED: 12/NOV/2014
| PURPOSE: My answer for the subject Programming Technique
| 2014/2015 Semester 1 Labsheet 4.
+--------------------------------------------------------------------
| LANGUAGE: C
@nikAizuddin
nikAizuddin / veg.sh
Last active August 29, 2015 14:10
BCN2053 Operating System Lab Sheet 6 (BASH)
#!/bin/bash
# ==========================================================
# This script requires user to input the weight
# of the lettuce. The output of the script
# will display the total amount of price base
# on the weight (Assume that 1kg is RM2.50).
#
# Sample output will be:
#
@nikAizuddin
nikAizuddin / veg.rb
Created November 30, 2014 19:45
BCN2053 Operating System Lab Sheet 6 (RUBY)
#!/bin/ruby
# ==========================================================
# This script requires user to input the weight
# of the lettuce. The output of the script
# will display the total amount of price base
# on the weight (Assume that 1kg is RM2.50).
#
# Sample output will be:
#
@nikAizuddin
nikAizuddin / veg.pl
Created November 30, 2014 19:47
BCN2053 Operating System Lab Sheet 6 (PERL)
#!/bin/perl
# ==========================================================
# This script requires user to input the weight
# of the lettuce. The output of the script
# will display the total amount of price base
# on the weight (Assume that 1kg is RM2.50).
#
# Sample output will be:
#