Factorial

Description:           This program find the factorial of a given number.   Primary Inputs:    Number Primary Output:    Factorial of the given number Platform Used:      Turbo C++ version 3.0, Borland International Inc.   /*program to find factorial of a number*/ #include #include /*prototype declaration of a function*/ unsigned long int fact(int); void main() { int x; char another='y'; unsigned ...

Evaluate Postfix Expression

Description:           This program evaluates a given postfix expression.   Primary Inputs:     A postfix expression Primary Output:    The evaluated result of the given postfix expression. Platform Used:      Turbo C++ version 3.0, Borland International Inc.   #include #include #include #include /*Maximum size of the postfix expression to take*/ #define maxsize 50 struct post { double stack[maxsize/2]; char exp[maxsize]; ...

Binary Search 1

Description:           This program implements the binary search algorithm.   Primary Inputs:    An array of 10 numbers (sorted in increasing order), and another number to be searched. Primary Output:    Gives the location of the number in the array(if found). Platform Used:      Turbo C++ version 3.0, Borland International Inc.   /* This program implements the Binary * Search Algorithm on ...

Binary Adder

Description:           This program performs the addition of two binary numbers.   Primary Inputs:    Two binary numbers Primary Output:    Summation of the two input binary numbers Platform Used:      Turbo C++ version 3.0, Borland International Inc.   /* This program adds two binary numbers */ #include #include #include #define null 0 struct node { struct node *next; /*Pointer to next ...

Adding rows and columns in JTable dynamically 5

Adding rows and columns in JTable dynamically
Java Source code to add Row and Column in JTable dynamically package com.example; import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Vector; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.WindowConstants; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; public class JTableSample { private JFrame mainFrame ; private JTable ...

Russian Peasant Multiplication 2

Russian Peasant Multiplication
Description: Russian Peasant Multiplication. This program allows one to do multiplication by just doing muliplication or division by 2 (and addition). This is interesting since computers generally use base 2 arithmetic.The algorithm is as follows. Start two rows, one with the multiplicand (say, A) and the other the multiplier (say B). The goal is to ...