Sort By:  Date  -  Rank  -  Title
ISO - OSI Model
/* Draw ISO - OSI Model using C */ #include< stdlib.h> #include< graphics.h> #include< conio.h> #include< stdio.h> void main() { int driver, mode; int i,j; driver = DETECT; initgraph(&driver;,&mode;,""); outtextxy(250,450,"ISO OSI Model"); delay(2000); outtextxy(90,30,"Sender"); delay(500); setcolor(6); for(i=50;i< =350;i+=50) { rectangle(200,i,50,i+30); delay(500); } setcolor(10); outtextxy(70,60,"Application"); delay(500); outtextxy(70,110,"Presentation"); delay(500); outtextxy... Read Full Story
PC to PC Communication using RS-232
/*Aim: PC to PC Communication using RS-232 in 'C'. */ #include #include #define COM1 0 #define DATA_READY 0x100 #define SETTINGS ( 0x80 | 0x02 | 0x00 | 0x00) int main(void) { int in, out, status; bioscom(0, SETTINGS, COM1); /*initialize the port*/ cprintf("Data sent to you: "); while (1) { status = bioscom(3, 0, COM1); /*wait until get a data*/ if (status & DATA_READY) if ((out = bioscom(2, 0, COM1) & 0x7F) != 0) /*input a data... Read Full Story
DIJKSRTRA'S ALGORITHM
/*Implementation of Shortest Path Algorithm(DIJKSRTRA's ALGORITHM) in C*/ #include< stdio.h> #include< conio.h> #include< process.h> #include< string.h> #include< math.h> #define IN 99 #define N 6 int dijkstra(int cost[][N], int source, int target); void main() { int cost[N][N],i,j,w,ch,co; int source, target,x,y; clrscr(); printf("\tShortest Path Algorithm(DIJKSRTRA's ALGORITHM\n\n"); for(i=1;i< N;i++) for(j=1;j< N;j++) cost[i][j] = IN; for(x=1;x< N;x++) { for(y=x+1;y< N;y... Read Full Story
Calculation Of CRC
/* Calculation of CRC (Cyclic Redundancy Check)*/ #include< stdlib.h> #include< conio.h> #include< stdio.h> void main() { int i,j,n,g,a,arr[20],gen[20],b[20],q[20],s; clrscr(); printf("Transmitter side:"); printf("\nEnter no. of data bits:"); scanf("%d",&n;); printf("Enter data:"); for(i=0;i< n;i++) scanf("%d",&arr;[i]); printf("Enter size of generator:"); scanf("%d",&g;); do{ printf("Enter generator:"); for(j=0;j< g;j++) scanf("%d",&gen;[j]); } while(gen[0]!=1); printf("\n\tThe... Read Full Story
LCM and HCM of two numbers
/* C++ program to calculate LCM and HCM of two numbers */ #include< stdio.h> #include< conio.h> void main() { int a,b,c; cout< < "Enter two nos : ; cin>>a>>b; c=a*b; while(a!=b) { if(a>b) a=a-b; else b=b-a; } cout< < "HCM \t= " < < a; cout< < "LCM \t= " < < c/a; getch(); } Read Full Story
Simple C++ program
/* C++ program on Computer Details */ #include< iostream.h> #include< conio.h> #define max 80 int y; int a = 0; int b = 0; long c = 0; int d,m,p; class computer { private: char s[10],x[10],h[10]; public: void getdata() { cout< < "Enter Computer Type : "; cin>>h; cout< < endl; cout< < "Enter CPU Type : "; cin>>x; cout< < endl; cout< < "Enter The Type Of OS : "; cin>>s; cout< < endl; cout< < "Enter The Memory In MB : "; cin>>m; cout< < endl; cout< < "Enter The... Read Full Story
Hybrid inheritance
/******** IMPLEMENTATION OF HYBRID INHERITANCE ********/ #include< iostream.h> #include< conio.h> class student { private : int rn; char na[20]; public: void getdata() { cout< < "Enter Name And Roll No : "; cin>>na>>rn; } void putdata() { cout< < endl< < na< < "\t"< < rn< < "\t"; } }; class test : public student { protected: float m1,m2; public: void gettest() { cout< < endl< < "Enter your marks In CP 1 And Cp 2 :"; cin>>m1>>m2; } void puttest() { cout< < m1... Read Full Story
Multilevel Inheritance
/********* IMPLEMENTATION OF MULTILEVEL INHERITANCE *********/ #include< iostream.h> #include< conio.h> class student // Base Class { protected: int rollno; char *name; public: void getdata(int b,char *n) { rollno = b; name = n; } void putdata(void) { cout< < " The Name Of Student \t: "< < name< < endl; cout< < " The Roll No. Is \t: "< < rollno< < endl; } }; class test:public student // Derieved Class 1... Read Full Story
OPERATOR OVERLOADING - Unary
/********* IMPLEMENTATION OF OPERATOR OVERLOADING (UNARY)*********/ #include< iostream.h> #include< conio.h> class unary { private: int x,y,z; public: unary(void) { cout< < "Enter Any Three Integer Nos. : "; cin>>x>>y>>z; } void display(void) { cout< < endl< < " The Three Nos. Are : "< < x< < " , "< < y< < " , "< < z; } void operator --() { x = --x; y = --y; z = --z; } void operator ++() { x = ++x; y = ++y; z = ++z; } }; void main() { clrscr(); unary... Read Full Story
Bubble Sort
/**** C Program For Implementation Of Bubble Sort. Sorting names entered by the user *****/ #include< stdio.h> #include< conio.h> #define MAX 10 char name[MAX][15]; void sort(int n) { int pa,cp,i,j,k,kk=0; char temp[15]; pa=n-1; cp=n-1; for(i=1;i< =pa;i++) { for(j=1;j< =cp;j++) { kk=kk+1; if(strcmp(name[j],name[j+1])>0) { strcpy(temp,name[j]); strcpy(name[j],name[j+1]); strcpy(name[j+1],temp); } } printf("\n List after %d pass is ",i); for(k=1;k< =n;k... Read Full Story