This blog is about my daily programming technologies I explore and work on. It contains data from my University learning materials to my Profession as Software Engineer. Programming in Asp.net, Windows Forms, JavaScript, HTML, OpenGL, Assembly Language, Dynamics CRM 2011.
Feedjit
Articles for you
Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts
Tuesday, September 22, 2015
Display Analog Clock of System Time in Assembly Language Sir Asim Munir
By
Saqib Khan
at
September 22, 2015
Display Analog Clock of System Time in Assembly Language Sir Asim Munir
2015-09-22T01:24:00-07:00
Saqib Khan
.ASM|Assembly Language|F09B|Islamic University|MASM|nasm|Programming|Sir Asim|System Programming|
Comments
Labels:
.ASM,
Assembly Language,
F09B,
Islamic University,
MASM,
nasm,
Programming,
Sir Asim,
System Programming
Tuesday, December 31, 2013
Preorder, Inorder, PostOrder C++ Plus Plus Program in Object Oriented Program Binary Search Tree BST in C++ Preorder, Inorder, PostOrder
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | #include<iostream>
using namespace std;
struct btnode
{
btnode *left, *right; int info;
btnode() { left =0; right= 0;info=0; }
btnode(int i,btnode *l=0,btnode*r =0)
{
info =i;left=l;right=r; } };
////////////////////////////////////////
class binarytree
{ btnode *root;
public:
btnode * &rroot() { return root; }
binarytree() { root = NULL; }
void preorder( btnode *b );
void inorder( btnode *b );
void postorder( btnode *b );
void insert(int item);
void insert(int item,btnode *&bt); };
////////////////////////////////////////
void binarytree :: preorder(btnode *bt)
{ // cout<<"Now Showing From Pre-order"<<endl;
if(! bt ==0)
{
cout<<" "<<bt->info;
preorder(bt->left);
preorder(bt->right); }
//cout<<endl;
}
////////////////////////////////////////
void binarytree::inorder(btnode *bt)
{
if(! bt ==0)
{ inorder(bt->left);
cout<<" "<<bt->info;
inorder(bt->right); }
}
///////////////////////////////////////
void binarytree:: postorder(btnode *bt)
{
if(! bt==0)
{ postorder(bt->left);
postorder(bt->right);
cout<<" "<<bt->info; }
}
//////////////////////////////////////
void binarytree::insert(int item)
{ if(root==0)
{ root=new btnode(item); }
else{ btnode*cur = root, *pre;
while(cur!=0)
{ pre = cur;
if(item<cur->info)
cur=cur->left;
else if( item> cur->info)
cur=cur->right; }
if(pre->info>item)
pre->left=new btnode(item);
else
pre-> right= new btnode(item); } };
//////////////////////////////////////////
void binarytree::insert(int item,btnode* &bt)
{
if(bt==0)
bt = new btnode(item);
else if( item<bt->info)
insert(item,bt->left);
else
insert( item,bt->right); }
////////////////////////////////////////////
void main()
{
binarytree bst;
bst.insert(37,bst.rroot());
bst.insert(8);
bst.insert(9);
bst.insert(5);
bst.insert(55);
bst.insert(39);
bst.insert(58);
bst.insert(72);
bst.insert(65);
bst.insert(18);
bst.insert(15);
cout<<"Now Showing From Pre-order"<<endl;
bst.preorder(bst.rroot());
cout<<endl;
cout<<"Now Showing From In-order"<<endl;
bst.inorder(bst.rroot());
cout<<endl;
cout<<"Now Showing From Post-order"<<endl;
bst.postorder(bst.rroot());
cout<<"\t\t\t\t\t\t\t"<<endl;
}
|
By
Saqib Khan
at
December 31, 2013
Preorder, Inorder, PostOrder C++ Plus Plus Program in Object Oriented Program Binary Search Tree BST in C++ Preorder, Inorder, PostOrder
2013-12-31T01:50:00-08:00
Saqib Khan
C++|Computer Science|Islamic University|Programming|
Comments
Labels:
C++,
Computer Science,
Islamic University,
Programming
C++ Plus Plus Program of Circular Queue in C++ Object Oriented Programm OOP C++
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | /****** C Program For Impelmetation Of Circular Queue *******/
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#define MAX 5
struct queue
{
int arr[MAX];
int rear,front;
};
int isempty(struct queue *p)
{
if(p->front ==p->rear)
return 1;
else
return 0;
}
void insertq(struct queue *p,int v)
{
int t;
t = (p->rear+1)%MAX;
if(t == p->front)
printf("\nQueue Overflow\n");
else
{
p->rear=t;
p->arr[p->rear]=v;
}
}
int removeq(struct queue *p)
{
if(isempty(p))
{
printf("\nQueue Underflow");
exit(0);
}
else
{
p->front=(p->front + 1)%MAX;
return(p->arr[p->front]);
}
}
void main()
{
struct queue q;
char ch;
int no;
q.rear=q.front =0;
insertq(&q,7);
insertq(&q,10);
insertq(&q,12);
insertq(&q,15);
insertq(&q,8);
printf("\n%d\n",removeq(&q));
printf("%d\n",removeq(&q));
printf("%d\n",removeq(&q));
printf("%d\n",removeq(&q));
removeq(&q);
system("cls");
getch();
}
|
By
Saqib Khan
at
December 31, 2013
C++ Plus Plus Program of Circular Queue in C++ Object Oriented Programm OOP C++
2013-12-31T01:48:00-08:00
Saqib Khan
C++|Computer Science|F09B|Islamic University|Programming|
Comments
Labels:
C++,
Computer Science,
F09B,
Islamic University,
Programming
C++ Plus Plus Program of Stack Object Oriented Program OOP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | #include<iostream>
using namespace std;
template<class type>
class stack
{
int top;
type arr[10];
public:
stack(){top=-1;}
void push(type a)
{
if(top>=10) {cout<<"\nStack Full\n";}
else
arr[++top]=a;
}
type pop()
{
if(top<=-1){cout<<"\nEmpty\n";return 0;}
return arr[top--];
}
bool isempty()
{
if(top==-1)
return true;
return false;
}
bool isfull()
{
if(top==10)
return true;
return false;
}
type topvalue(){return arr[top];}
};
void main()
{
stack <int>si;
si.push(34);
si.push(1);
si.push(2);
si.push(56);
si.push(100);
cout<<si.pop();
cout<<endl;
cout<<si.pop();
cout<<endl;
cout<<si.pop();
cout<<endl;
cout<<si.pop();
cout<<endl;
cout<<si.pop();
cout<<endl;
}
|
By
Saqib Khan
at
December 31, 2013
C++ Plus Plus Program of Stack Object Oriented Program OOP
2013-12-31T01:47:00-08:00
Saqib Khan
C++|Computer Science|Programming|
Comments
Labels:
C++,
Computer Science,
Programming
C++ Program of Implementation of Selection Sort in C++, C Plus Plus,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | #include <stdio.h>
#include <stdlib.h>
void swap(int *x,int *y)
{
int temp;
temp = *x;
*x = *y;
*y = temp;
}
void selection_sort(int list[], int n)
{
int i, j, min;
for (i = 0; i < n - 1; i++)
{
min = i;
for (j = i+1; j < n; j++)
{
if (list[j] < list[min])
{
min = j;
}
}
swap(&list[i], &list[min]);
}
}
void printlist(int list[],int n)
{
int i;
for(i=0;i<n;i++)
printf("%d\t",list[i]);
}
void main()
{
const int MAX_ELEMENTS = 10;
int list[MAX_ELEMENTS];
int i = 0;
// generate random numbers and fill them to the list
for(i = 0; i < MAX_ELEMENTS; i++ ){
list[i] = rand();
}
printf("The list before sorting is:\n");
printlist(list,MAX_ELEMENTS);
// sort the list
selection_sort(list,MAX_ELEMENTS);
// print the result
printf("The list after sorting:\n");
printlist(list,MAX_ELEMENTS);
}
|
By
Saqib Khan
at
December 31, 2013
C++ Program of Implementation of Selection Sort in C++, C Plus Plus,
2013-12-31T01:46:00-08:00
Saqib Khan
C++|Computer Science|F09B|Hardware Programming|Islamic University|Programming|
Comments
Labels:
C++,
Computer Science,
F09B,
Hardware Programming,
Islamic University,
Programming
C++ Plus Plus Program Simple Operator Overloading in C++, Easy Implementation, Airtime in C++ , C Plus Plus Program
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | #include<iostream.h>
#include<conio.h>
class airtime
{
private:
int hrs,min,sec;
public:
airtime() : hrs(0),min(0),sec(0){}
void settime();
void display();
airtime operator + (const airtime &a);
void operator += (const airtime &a);
int operator > (const airtime &a);
void operator ++ ();
void operator ++ (int);
};
void airtime::settime()
{
cout<<"Enter hours min and sec "<<endl;
cin>>hrs>>min>>sec;
cout<<endl<<endl;
}
void airtime::display()
{cout<<hrs<<":"<<min<<":"<<sec<<"\n";
}
airtime airtime::operator + (const airtime &a)
{
airtime temp;
temp.hrs=hrs + a.hrs;
temp.min=min + a.min;
temp.sec=sec + a.sec;
return temp;}
void airtime::operator += (const airtime &a)
{
sec+= a.sec;
min+=a.min;
hrs+=a.hrs;}
int airtime::operator > (const airtime &t)
{ if(hrs>t.hrs)
return 1;
else if(min>t.min)
return 1;
else if(sec>t.sec)
return 1;
else
return 0;
}
void airtime::operator ++ ()
{
++hrs;
++min;
++sec;
}
void airtime::operator ++ (int)
{
hrs++;
min++;
sec++; }
int main()
{
airtime a1,a2,a3,a4;
int result;
a1.settime();
a2.settime();
a3=a1 + a2;
a4+=a1;
result=a1>a2;
if(result==1)
cout<<"Time1 is greater than Time 2\n";
else
cout<<"Time2 is greater than Time 1\n";
++a1;
a2++;
a1.display();
a2.display();
a3.display();
a4.display();
getche();
return 0;
}
|
By
Saqib Khan
at
December 31, 2013
C++ Plus Plus Program Simple Operator Overloading in C++, Easy Implementation, Airtime in C++ , C Plus Plus Program
2013-12-31T01:42:00-08:00
Saqib Khan
C++|Computer Science|Islamic University|Programming|Sir Nadeem|
Comments
Labels:
C++,
Computer Science,
Islamic University,
Programming,
Sir Nadeem
Switch/Case in C++ easiest Implementation, C++ Burger Stand Program
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | #include<iostream>
using namespace std;
void ast();
class stand
{
private:
int bun,shami,b,s;
public:
void init()
{
cout<<"Enter the total No. of burgers "<<endl;
cin>>bun;
cout<<endl;
cout<<"Enter the total No. of shami "<<endl;
cin>>shami;
cout<<endl;
}
void sale()
{
if(bun<=0)
cout<<"Sorry, no stock for burger"<<endl;
else
{cout<<"No. of burgers sold "<<endl;
cin>>b;
cout<<endl;
bun=bun-b;
}
if(shami<=0)
cout<<"Sorry, no stock for shami"<<endl;
else
{
cout<<"No. of shami sold "<<endl;
cin>>s;
cout<<endl;
shami=shami-s;
}
}
void disp()
{
if(bun<=0)
cout<<"There is no stock for burger"<<endl;
else
cout<<"No. of burgers left "<<bun<<endl;
if(shami<=0)
cout<<"There is no stock for shami"<<endl;
else
cout<<"No. of shami left "<<shami<<endl;}
};
void ast()
{
for(int i=1;i<=9;i++)
{cout<<"*";}
}
void main()
{
stand s1,s2,s3,s4;
int ch,sl;
char c;
cout<<endl;
cout<<"welcome to the burger shop"<<endl;
ast();
do{cout<<endl;
cout<<"Press 1 for stand# 01."<<endl;
cout<<"Press 2 for stand# 02."<<endl;
cout<<"Press 3 for stand# 03."<<endl;
cout<<"Press 4 for stand# 04."<<endl;
cout<<"Press 5 for exit"<<endl;
cin>>ch;
switch(ch)
{
case 1:
cout<<"Stand no 1"<<endl;
cout<<"Press 1 for initialization"<<endl;
cout<<"Press 2 for sale"<<endl;
cout<<"Press 3 for display"<<endl;
cout<<"Press 4 for main menu"<<endl;
cin>>sl;
switch(sl)
{
case 1:
s1.init();
break;
case 2:
s1.sale();break;
case 3:
s1.disp();break;
default:
cout<<"Sorry! You have enterd an Invalid Choice"<<endl;break;
}
break;
case 2:
cout<<"Stand no 2"<<endl;
cout<<"Press 1 for initialization"<<endl;
cout<<"Press 2 for sale"<<endl;
cout<<"Press 3 for display"<<endl;
cout<<"Press 4 for main menu"<<endl;
cin>>sl;
switch(sl)
{
case 1:
s2.init();break;
case 2:
s2.sale();break;
case 3:
s2.disp();break;
default:
cout<<"Sorry! You have enterd an Invalid Choice"<<endl;break;
}
break;
case 3:
cout<<"Stand no 3"<<endl;
cout<<"Press 1 for initialization"<<endl;
cout<<"Press 2 for sale"<<endl;
cout<<"Press 3 for display"<<endl;
cout<<"Press 4 for main menu"<<endl;
cin>>sl;
switch(sl)
{
case 1:
s3.init();break;
case 2:
s3.sale();break;
case 3:
s3.disp();break;
default:
cout<<"Sorry! You have enterd an Invalid Choice"<<endl;break;
}
break;
case 4:
cout<<"Stand no 4"<<endl;
cout<<"Press 1 for initialization"<<endl;
cout<<"Press 2 for sale"<<endl;
cout<<"Press 3 for display"<<endl;
cout<<"Press 4 for main menu"<<endl;
cin>>sl;
switch(sl)
{
case 1:
s4.init();break;
case 2:
s4.sale();break;
case 3:
s4.disp();break;
}
break;
case 5:
exit(0);break;
default:
{cout<<endl<<"Sorry! You have enterd an Invalid Choice";break;}
}
cout<<endl;
cout<<"Do you want to continue: (Y/N)"<<endl;
cin>>c;
}while(c!='n' && c!='N');
}
|
By
Saqib Khan
at
December 31, 2013
Switch/Case in C++ easiest Implementation, C++ Burger Stand Program
2013-12-31T01:40:00-08:00
Saqib Khan
C++|Computer Science|F09B|Islamic University|Programming|System Programming|
Comments
Labels:
C++,
Computer Science,
F09B,
Islamic University,
Programming,
System Programming
Simplest and Easiest Inheritance in C++: Easy Implementation of Inheritance in C++ Student/Teacher Program in C++
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | #include<iostream.h>
#include<conio.h>
#define size 20
class person
{
protected:
char name[size];
int id;
public:
person():id(0) {name[size]=' ';}
virtual void getd();
virtual void putd();
virtual int isoutstanding()=0;
};
class student : public person
{
protected:
float gpa;
public:
student():person(){gpa=0;}
void getd();
void putd();
int isoutstanding();
};
class teacher : public person
{
protected:
int publish;
public:
teacher():person(){publish=0;}
void getd();
void putd();
int isoutstanding();
};
//defineing functions for student class
void student::getd()
{
cout<<"Enter the name of student\n";
cin.get(name,size);
cout<<"Enter ID or REG\n";
cin>>id;
cout<<"Enter gpa\n";
cin>>gpa;
}
void student::putd()
{
int i=0;
cout<<"Name of student is\n";
while(name[i]!='\0')
{
cout<<name[i];
i++;
}
cout<<"Reg or ID is\n";
cout<<id;
cout<<"gpa is\n";
cout<<gpa;
}
int student::isoutstanding()
{
if(gpa>=3.5)
return 1;
else
return 0;
}
//defineing methods of teacher
void teacher::getd()
{
cout<<"Enter the name of teacher\n";
cin.get(name,size);
cout<<"Enter ID or REG\n";
cin>>id;
cout<<"Enter number of publishes\n";
cin>>publish;
}void teacher::putd()
{
int i=0;
cout<<"Name of teacher is\n";
while(name[i]!='\0')
{
cout<<name[i];
i++;
}
cout<<"Reg or ID is\n";
cout<<id;
cout<<"Number of publish is\n";
cout<<publish;
}
int teacher::isoutstanding()
{
if(publish>=5)
return 1;
else
return 0;
}
int main()
{
person *pptr[20];
int n=0;
char choice,reply;
do
{
cout<<"Enter your choice";
cin>>choice;
if(choice=='s')
{
pptr[n] = new student;
}
else
{
pptr[n] = new teacher;
}
pptr[n]->getd();
n++;
cout<<"Do you want to run it again\n";
cin>>reply;
}
while(reply=='y');
getche();
return 0;
}
|
By
Saqib Khan
at
December 31, 2013
Simplest and Easiest Inheritance in C++: Easy Implementation of Inheritance in C++ Student/Teacher Program in C++
2013-12-31T01:32:00-08:00
Saqib Khan
C++|Computer Science|F09B|Hardware Programming|Islamic University|MASM|nasm|Programming|System Programming|Visual Studio 2012|
Comments
Labels:
C++,
Computer Science,
F09B,
Hardware Programming,
Islamic University,
MASM,
nasm,
Programming,
System Programming,
Visual Studio 2012
Subscribe to:
Posts (Atom)
