Showing posts with label Practical codes. Show all posts
Showing posts with label Practical codes. Show all posts

SPCC (System Programming and Compiler Construction) practical programs

Views:



These are the System Programming and Compiler Construction (SPCC) programs for practical exam of TE COMPS (2011-12). Refer it and modify according to the need.
(You can download all the SPCC programs from SkyDrive. Click here to download...)


1. TWO PASS ASSEMBLER


/* Note: Please create a Sp.txt file at the same place where you are saving this .java file. Copy the these lines in the text file
JOHN START 0
     USING *,15
     L     1,FIVE
     A     1,FOUR
     ST    1,TEMP
FOUR DC    F'4'
FIVE DC    F'5'
TEMP DS    1F
     END 

and only then compile and run the program.
*/

import java.io.*;

class Assembler
{
FileInputStream fin= new FileInputStream("Sp.txt");
DataInputStream in= new DataInputStream(fin);
String s[]=new String[20]; int n,i;
String mot[][]=new String[20][20]; int top;
String pot[][]=new String[20][20]; int top1;
String st[][]=new String[20][20]; int top2;
String bt[][]=new String[20][2];
String lt[][]=new String[20][20]; int top3;
String pass1[][]=new String[20][20]; int top4;
String pass2[][]=new String[20][20];
int j,lc,reg,f1,f2,f3;
boolean flag;
Assembler()throws IOException
{
i=top=top1=top2=top3=top4=-1;
String temp=in.readLine();
while(temp!=null)
{
s[++i]=temp;
temp=in.readLine();
}
n=i;
for(j=0;j<=15;j++)
{
bt[j][0]="N";
bt[j][1]="-";
}
}
void initialize()
{
String psedo_char[]={ "START" , "USING" , "DROP" , "EQU" , "END" , "DS" , "DC" };
String mcop[]={ "A" , "L" , "ST" , "MVC" };
String dtype[]= { "DS" , "DC" };
compute(psedo_char,mcop,dtype);
display();
}
void compute(String psedo_char[],String mcop[],String dtype[])
{
int p1,p2,p3,p4;
String s1;
char c1;
f1=f2=f3=-1;
boolean f6=false;
lc=0;
flag=true;
for(i=0;i<=n;i++)
{
f1=s[i].indexOf("START");
f2=s[i].indexOf("USING");
f3=s[i].indexOf("L ");
findlc();

OOSE (Object Oriented System Engineering) practical exam stuff

Views:


Download OOSE reports for practical exams. Click on the links given below. The files can be downloaded from 2shared website. The files have been abstracted from Skydrive website where Juzer Bhinderwala has uploaded all the files.

OOSE practicals list:
1) Airline System
2) ATM
3) Hospital Management
4) Mall management
5) Online medical store
6) Travel Agency
7) Inventory Management
8) Course Registration
9) Car Rental System
10)Online Shopping
11)Restaurant Management
12)Railway Reservation
13)Library Management
14)Movie Library Management System
15)Banking System
16)Hotel Reservation Management
17)Online Book Store
18)College Management

AMP (Advanced Microprocessor) practical programs

Views:



1. WAP to find even and odd number

data segment
message db 13,10,'Enter no or press "q" to quit',13,10,'$'
evn db 13, 10,'No is Even',13,10,'$'
odd db 13,10,'No is Odd',13,10,'$'
no db 02h
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
up:lea dx,message
mov ah,09h
int 21h

mov ah,01h
int 21h

cmp al,'q'
jz exit

mov ah,00h
cmp al,39h
jge up

cmp al,30h
jl up

sub al,30h
div no

cmp ah,00h
jnz odd1

lea dx,evn
mov ah,09h
int 21h
jmp up

odd1:lea dx,odd
mov ah,09h
int 21h
jmp up

exit:mov ah,4ch
int 21h

MP practical programs

Views:



These are the Microprocessor practical codes for the students of Computer Engineering of Mumbai. 

University.

1) DS – ES-String

data segment
src db 01h,02h,03h,04h,05h,06h,07h,08h,09h,0Ah
data ends

extra segment
dest db ?
extra ends

code segment
assume cs:code,ds:data,es:extra
start:
mov ax,data
mov ds,ax
mov ax,extra
mov es,ax
mov cl,0Ah
LEA si,src
LEA di,dest
Rep MOVSB
int 03h
code ends
end start


 2) DS – ES

data segment
src db 01h,02h,03h,04h,05h,06h,07h,08h,09h,0Ah
data ends

extra segment
dest db ?
extra ends

code segment
assume cs:code,ds:data,es:extra
start:
mov ax,data
mov ds,ax
mov ax,extra
mov es,ax
mov cl,0Ah
LEA si,src
LEA di,dest
up:mov al,[si]
mov es:[di],al
inc si
inc di
dec cl
jnz up
int 03h
code ends
end start


 3) PALINDROME.

data segment
string db 'KATAKA$'
p db ?
data ends
code segment
assume cs:code, ds:data
start:
            mov ax,data
            mov ds,ax
            mov cl,00h
            lea si,string
      up: mov al,[si]
            cmp al,24h
            jz down

CG (Computer Graphics) practical programs

Views:


These are the Computer Graphics practical codes for the Computer Engineering students of Mumbai University.

1) DDA line:
#include<iostream.h>
#include<conio.h>
#include<graphics.h>
#include<Math.h>

int round(float m);

void DDA(int x1,int x2,int y1,int y2,int color)
{
  int dx=x1-x2,dy=y1-y2;
  float a=x1,b=y1,steps;
  putpixel(round(a),round(b),color);
  if(abs(dx)>abs(dy))
  steps=abs(dx);
  else
  steps=abs(dy);
  float xinc=dx/float(steps);
  float yinc=float(dy)/steps;
  for(int i=1;i<=steps;i++)
  {
    a+=xinc;
    b+=yinc;
    putpixel(round(a),round(b),color);
  }
}

int round(float m)
{return(m+0.5);}

void main()
{
  int gd=DETECT,gm;
  initgraph(&gd,&gm,"C:\\TC\\BGI");
  DDA(50,50,250,350,RED);
  DDA(250,250,250,350,GREEN);
  DDA(150,250,350,450,RED);
  DDA(150,50,350,450,GREEN);
  DDA(50,-50,150,250,RED);
  DDA(250,350,150,250,GREEN);
  DDA(80,80,250,350,RED);
  DDA(130,30,320,420,GREEN);
  DDA(240,340,190,290,GREEN);
  getch();
}

<input type="hidden" name="IL_IN_TAG" value="1"/>

2) Bresenham line:

#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<graphics.h>
int sign(int a,int b)
{
if((a-b)<0)
return -1;
else
if((a-b)==0)
return 0;
else
return 1;
}//end sign

void bresen(int x1,int y1,int x2,int y2)
{
int x,y,dx=abs(x2-x1),dy=abs(y2-y1),p,xend,yend;
if(dx>dy)
{
if(x1>x2)
{
x=x2; y=y2;
xend=x1;
}
else
{
x=x1; y=y1;
xend=x2;
}
p=2*dy-dx;
putpixel(x,y,RED);
while(x<xend)
{
x++;
if(p<0)
p=p+2*dy;
else
{
y=y+sign(y2,y1);
p=p+2*(dy-dx);
}
putpixel(x,y,RED);
}//end while
}//end if
else
{
if(y1>y2)
{
y=y2; x=x2;
yend=y1;
}
else
{
y=y1; x=x1;
yend=y2;
}
p=2*dx-dy;
putpixel(x,y,RED);
while(y<yend)
{
y++;
if(p<0)
p=p+2*dx;
else
{
x=x+sign(x2,x1);
p=p+2*(dx-dy);
}
putpixel(x,y,RED);
}//end while
}//end else
}//end bresen

void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"C:\\TC\\BGI");

AOAD (Analysis of Algorithm and Design) practical programs

Views:



These are the AOAD (Analysis of Algorithm and Design) practical codes for the Computer Engineering students of Mumbai University.

1) All  Pairs shortest path:
import java.util.*;
class AllPair
{
    public static void main(String args[])
    {
        Scanner s = new Scanner(System.in);
        int cm[][],x[][], v, e, k, i ,j;
        System.out.println("Enter the number of vertices");
        v = s.nextInt();
        System.out.println("Enter the number of edges");
        e = s.nextInt();
        cm = new int[v+1][v+1];
        for(i=1; i<=v; i++)
        for(j=1; j<=v; j++)
        {
            System.out.println("Enter the cost of edges" + i + "-" + j);
            cm[i][j] = s.nextInt();
        }
        x = new int[v+1][v+1];
        for(i=1; i<=v; i++)
        {
            for(j=1; j<=v; j++)
            {
                x[i][j] = cm[i][j];
                System.out.print(x[i][j]+"\t");
            }
            System.out.println();
        }
       
        for(k=1; k<=v ; k++)
        {
            for(i=1; i<=v; i++)
            {
                for(j=1; j<=v; j++)
                {
                    x[i][j] = Math.min(x[i][j], (x[i][k] + x[k][j]));
                }
            }
        }
        System.out.println("The shortest path is");
        {
            for(i=1; i<=v; i++)
            {
                for(j=1; j<=v; j++)
                {
                    System.out.print(x[i][j] + "\t");
                }
                System.out.println();
            }
        }
    }
}


2) Bellman ford:

import java.util.Scanner;
class BMF1
{
int n,adj[][],cost[][],u,v,i,j,k,dist[];
BMF1()
{
Scanner src=new Scanner(System.in);
System.out.println("Enter number of vertices");
n=src.nextInt();
adj=new int[n+1][n+1];
cost=new int[n+1][n+1];
dist=new int[n+1];
System.out.println("Enter adjecency matrix");
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
{
adj[i][j]=src.nextInt();
if(i!=j)
cost[i][j]=32767;
}
for(i=1;i<=n;i++)

OS (Operating Systems) practical programs

Views:


These are the Operating Systems (OS) practical codes for the Computer Engineering students of Mumbai University.

OS programs for practical exam. Click the link given below to download...
OS practical programs

DSF (Data Structure and Files) practical codes

Views:


These are the Data Structure and files (DSF) related codes that I am sharing with all the computer students. Download DSF practical codes for free. Refer the link given below.

<input type="hidden" name="IL_IN_TAG" value="1"/>

Click HERE.
Share it among your friends.
Good Luck..!!
Like "Jitu's Pensieve" on Facebook
×