Posts

Showing posts from June, 2014

Bind the grid view from text boxes in C#.net

Bind the grid view from text boxes in C#.net in this article i am binding gridview though textboxes. To do this i have to make first an imaginary table (Data table) and then provide it source to gridview. DataTable table = new DataTable();//making data table             table.Columns.Add("ID", typeof(int));//add columns             table.Columns.Add(" Name", typeof(string));             table.Columns.Add("gender", typeof(string));             table.Columns.Add("Date", typeof(DateTime));                          //  add  Rows.                         table.Rows.Add(1, "Umar", "Male", DateTime.Now);             table.Rows.Add(2, "Hayat", "Male", DateTime.Now);   ...

Implementation of Radix sort in C++

Implementation of Radix sort in C++ #include <iostream> using namespace std; void print(int *input, int n) {  for (int i = 0; i < n; i++)       cout << input[i] << "\t"; } void radixsort(int *input, int n) {   int i;   int maxNumber = input[0];   for (i = 1; i < n; i++)   {     if (input[i] > maxNumber)       maxNumber = input[i];   }   int exp = 1;   int *tmpBuffer = new int[n];   while (maxNumber / exp > 0)   {     int decimalBucket[10] = {  0 };     // count the occurences in this decimal digit.     for (i = 0; i < n; i++)       decimalBucket[input[i] / exp % 10]++;       // for this decimal place.     for (i = 1; i < 10; i++)       decimalBucket[i] += decimalBucket[i - 1];     // Re order the numbers in the tmpbuffer and ...

Fibonacci Sequence in C++

Fibonacci Sequence in C++  #include <iostream.h> int fib(int n) { if(n<=1) return n; else return(fib(n-1)+fib(n-2)); } int main() { int N; cout<<"Enter an integer"; cin>>N; cout<<"Fibbnaci sequense of No"<<N<<":"; for(int i=1;i<=N;i++) { cout<<fib(i)<<endl; } system("pause"); return 0; } BY Hafiz Muhammad Umar Hayat