Professional Documents
Culture Documents
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
class flag
{
int n, i, a[10], ele, freq;
public:
void read();
void find();
void display();
};
void main()
{
// clrscr();
flag F;
F.read();
F.find();
F.display();
getch();
======end======
Lab 2: program /* insert an element into an array */
#include<iostream.h>
#include<process.h>
#include<iomanip.h>
#include<conio.h>
class flag
{
int n, i, a[10], ele, p;
public:
void read();
void find();
void display();
};
}
void flag :: display()
{
cout<<endl<<"The array is "<<endl;
for(i=0; i<n; i++)
cout<<setw(4)<<a[i];
}
void main()
{
clrscr();
flag F;
F.read();
F.find();
F.display();
getch();
}
======end======
Lab 3: program /* delete an element from an array */
#include<iostream.h>
#include<process.h>
#include<iomanip.h>
#include<conio.h>
class flag
{
int n, i, a[10], ele, p;
public:
void read();
void find();
void display();
};
}
void flag :: display()
{
cout<<endl<<"The array is "<<endl;
for(i=0; i<n; i++)
cout<<setw(4)<<a[i];
}
void main()
{
clrscr();
flag F;
F.read();
F.find();
F.display();
getch();
}
======end======
void main()
{
clrscr();
flag F;
F.read();
F.find();
F.display();
getch();
======end======
Lab 5: program /* binary search */
#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
class flag
{
int n, i, a[10], ele, loc;
public:
void read();
void find();
void display();
};
void main()
{
clrscr();
flag F;
F.read();
F.find();
F.display();
getch();
======end======
Lab 6: program /* simple interest */
#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
class flag
{
int p,t,r,s;
public:
void read();
void find();
void display();
};
void main()
{
clrscr();
flag F;
F.read();
F.find();
F.display();
getch();
======end======
void main()
{
clrscr();
flag F;
F.read();
F.find();
F.display();
getch();
}
======end======
Lab 8: program /* function overloading */
#include<iostream.h>
#include<iomanip.h>
#include<math.h>
#include<conio.h>
class flag
{
float s;
public:
double area(double a)
{ return a*a; }
double area(double a, double b)
{ return a*b; }
double area(double a, double b, double c)
{ s=(a+b+c)/2;
return(sqrt(s*(s-a)*(s-b)*(s-c)));
}
};
void main()
{
double x,y,z;
int ch;
flag F;
clrscr();
cout<<endl<<" 1. Area of a Square 2. Area of Rectangel 3. Area of traingle ";
cout<<endl<<" Enter you choice ";
cin>>ch;
if(ch==1)
{
cout<<endl<<"Enter one side ";
cin>>x;
cout<<endl<<"Area of a Square is "<<F.area(x);
}
else
if(ch==2)
{
cout<<endl<<"Enter two side ";
cin>>x>>y;
cout<<endl<<"Area of a Rectangle is "<<F.area(x,y);
}
else
if(ch==3)
{
cout<<endl<<"Enter Three side ";
cin>>x>>y>>z;
cout<<endl<<"Area of a Triangle is "<<F.area(x,y,z);
}
else
cout<<endl<<"Invalid Input";
getch();
}
======end======
Lab 9: program /* inline function */
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
class flag
{
int n;
public:
flag(int m) // in this constructor we have one argument
{
n= m;
}
int cube();
};
inline int flag::cube()
{
return (n*n*n);
}
void main()
{
int n;
clrscr();
cout<<endl<<" Enter a number ";
cin>>n;
flag F = n; // here we are assigning n value directly to the object because it has only one
argument in the member function
cout<<endl<<" Cube of "<<n<< " is "<<F.cube();
getch();
}
======end======
Lab 10: program /* Sum of the series */
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
class flag
{
int i, x, n;
public:
double find();
flag(int a, int b)
{
x =a;
n=b;
}
};
double flag :: find()
{
int term;
int sum = 1;
term = x;
for(i=1; i<=n; i++)
{
sum=sum+term;
term = term*x;
}
return sum;
}
void main()
{
int x, n;
clrscr();
cout<<endl<<" Enter base value and power ";
cin>>x>>n;
flag F(x,n);
flag S =F;
cout<<endl<<" Object1 : sum of the series is "<<F.find();
cout<<endl<<" Object2 : sum of the series is "<<S.find();
getch();
}
======end======
Lab 11: program /* inheritance */
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
class flag
{
int roll;
char name[40];
public:
void read()
{
cout<<"Enter the Student name ";
cin.getline(name,30);
cout<<endl<<"Enter the Student Register Number ";
cin>>roll;
}
void display()
{
cout<<endl<<" Struent Register Number "<<roll;
cout<<endl<<" Student Name "<<name;
}
};
class sample : public flag
{
int m1,m2, total;
public:
void read2()
{
cout<<"Enter 2 subject marks ";
cin>>m1>>m2;
total=m1+m2;
}
void display2()
{
cout<<endl<<" Subject1 "<<m1;
cout<<endl<<" Subject2 "<<m2;
cout<<endl<<" Total "<<total;
}
};
void main()
{
clrscr();
sample F;
F.read();
F.read2();
F.display();
F.display2();
getch();
======end======
Lab 12: program /* pointers */
/* pointer */
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
class flag
{
float r,h,v;
public:
void read();
void display();
};
void main()
{
clrscr();
flag F;
F.read();
F.display();
getch();
======end======
Lab 13: program /* stack */
#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
#include<ctype.h>
#define MAX 10
class flag
{
int a[MAX];
int i, top;
public:
flag()
{
top = -1;
}
void push(int ele)
{
if(top == MAX-1)
{
cout<<endl<<"Stack is full ";
return;
}
top++;
a[top]=ele;
cout<<endl<<ele<<" is pushed in to Stack";
}
void display()
{
if(top != -1)
{
cout<<endl<<" Stack Contains ";
for( i=0; i<=top; i++)
cout<<setw(4)<<a[i];
}
else
cout<<endl<<" Stack is empty";
}
};
void main()
{
flag F;
char ch;
int ele;
clrscr();
F.display();
cout<<endl<<" Do you want to push an element (Y/n)? ";
cin>>ch;
while(toupper(ch) == 'Y')
{
cout<<endl<<" Enter a number ";
cin>>ele;
F.push(ele);
F.display();
cout<<endl<<" Do you want to push nother element into stack (Y/N)? ";
cin>>ch;
}
getch();
}
======end======
Lab 14: program /* push */
#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
#define MAX 10
class flag
{
int a[MAX];
int top;
public:
flag()
{
top = -1;
}
void push(int ele)
{
if(top == MAX-1)
{
cout<<endl<<"Stack is full ";
return;
}
top++;
a[top]=ele;
cout<<endl<<ele<<" is pushed in to Stack";
}
void display()
{
if(top != -1)
{
cout<<endl<<" Stack Contains ";
for(int i=0; i<=top; i++)
cout<<setw(4)<<a[i];
}
else
cout<<endl<<" Stack is empty";
}
void pop()
{
if(top == -1)
{
cout<<endl<<"Stack is empty ";
return;
}
else
{
int data = a[top];
top--;
cout<<endl<<data<<" is poped from the stack";
}
}
};
void main()
{
flag F;
clrscr();
F.display();
F.push(10);
F.display();
F.push(20);
F.display();
F.push(30);
F.display();
F.pop();
F.display();
getch();
}
======end======
Lab 15: program /* queue */
#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
#define MAX 10
class flag
{
int q[MAX];
int first,last;
int count;
public:
flag();
void enqueue(int x);
int dequeue();
void display();
};
flag :: flag()
{
first = 0;
last = MAX-1;
count = 0;
}
void flag :: enqueue(int x)
{
last = (last+1) % MAX;
q[last] = x;
cout<<endl<<x<<" is inserted ";
count++;
}
int flag :: dequeue()
{
int x = q[first];
first=(first+1) % MAX;
count--;
cout<<endl<<x<<" is deleted ";
return x;
}
void flag :: display()
{
if(count > 0)
{
cout<<endl<<" Queue contains ";
for(int i=first; i<=last; i++)
cout<<q[i]<<setw(4);
}
else
cout<<endl<<" Queue is empty";
}
void main()
{
flag F;
clrscr();
F.display();
F.enqueue(10);
F.display();
F.enqueue(20);
F.display();
F.enqueue(30);
F.display();
F.dequeue();
F.display();
getch();
}
======end======
Lab 16: program /* lined list */
/* linked list*/
#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
class link
{
struct Node
{
int data;
Node *link;
}*START;
public:
link();
void print();
void append(int num);
void count();
};
link::link()
{
START = NULL;
}
void link::print()
{
if (START == NULL)
{
cout<<endl<<"Linked list is empty"<<endl;
return;
}
1. Create a table for house hold Electricity bill with the following:-
SQL> create table electricity (rr-num varchar(8), number char(8), billing date, units number(4));
---------------------------------------------------------------------------------------------------------
======end======
SQL -2
Create s student data base and compute the result
1. Create a table: -
SQL> create table stud (id number(4), name varchar(20), sub1 number(3), sub2
number(3), sub3 number(3), sub4 number(3), sub5 number(3), sub6 number(3));
ID NAME
-----------------------------
125 Anu
126 Kavya
128 Bhuvan
127 Zain
124 Santhosh
======end======
SQL -3
1. Generate the employee and computer the salary based on the department
SQL> create table employee ( emp_id number(4), dept_id number(4), name varchar(20),
salary number(8));
4. Generate the employee and computer the salary based on the department
SQL> create table dept ( dept_id number(4), name varchar(20), supervisor char(12));
2 Account Reddy
3 Sales Mehra
4 Apprentice Ashish
7. Command to find the name of all employee who works for the account department.
SQL> select * from employee where dept_id = ( select dept_id from dept where name='Account');
8. Command to find the number of employee who works for the account department.
SQL> select count( *) from employee where dept_id = ( select dept_id from dept where
name='Account');
----------------
9. Command to find minimum, maximum and average slaary of the employee who works for the
account department.
SQL> select min(salary) from employee where dept_id = ( select dept_id from dept where
name='Account');
--------------------
25400
SQL> select max(salary) from employee where dept_id = ( select dept_id from dept where
name='Account');
35000
SQL> select avg(salary) from employee where dept_id = ( select dept_id from dept where
name='Account');
--------------------
30200
SQL> select * from employee where dept_id = ( select dept_id from dept where
SUPERVISOR='Mehra'');
11. Command to retrieve the department name for each department name for each department
where only two works.
SQL> select name from dept where dept_id = ( select dept_id from employee group by dept-id
having count(*)=2');
-----------------
Account
12. Command to increase the salary of all employee in the sales department by 15%.
SQL> update employee set salary = salary + salary * 0.15 where dept_id = ( select dept_id from
dept where name='Sales');
1 row updated.
13. Command to add a new column to the table employee called bonus and compute 5% of the
salary to the said field.
14. Command to delete all the row for employee in the apprentice department.
SQL> delete from employee where dept_id = (select dept_id from where name = 'Apprentice');
1 row deleted.
======end======
SQL -4
CNAME CHAR(14)
CADDRESS VARCHAR(20)
CPHONE CHAR(12)
SQL> create table bank (accno number(8) not null, tramount number98), trdate date, trtype
char, cno number(4));
TRAMOUNT NUMBER(8)
TRADATE DATE
TRTYPE CHAR
CNO NUMBER(4)
SQL> insert into bank values ( 1300, 2396, '01-MAR-2022', 'D' , 100);
SQL> insert into bank values ( 13101, 7000, '26-MAR-2022', 'C' , 100);
SQL> insert into bank values ( 13102, 2400, '01-JAN-2022', 'C' , 102);
SQL> insert into bank values ( 13103, 5968, '14-FEB-2022', 'D' , 103);
ACCNO CNO
------------- --------------
1300 100
13101 100
13102 102
TRTYPE COUNT(*)
--------------- ---------------
D 2
C 2
1 row delete.
CNO
---------------
100
102
103
12. Create view name as SEE only 2 attribute such as cno, cphone from costomer
view created.
CNO CPHONE
---------------- -----------------
100 25552
101 36545
102 78564
--------------
kiran
ganes
anush
======end======
HTML 01
Write a html program to create a student time table.
<html>
<body>
<h1><center>Application Form</center></h1>
<form>
</textarea>
<br><br>
<input type="checkbox" value="physics">Physics<br>
<input type="checkbox" value="chemistry">Chemistry<br>
<input type="checkbox" value="mathematics">Mathematics<br><br>
Gender:<br>
<table border="2">
<tr>
<th>Monday</th>
<th>Tuesday</th>
<th>Wednesday</th>
<th>Thursday</th>
<th>Friday</th>
<th>Saturday</th>
</tr>
<tr>
<td>physics</td>
<td>chemistry</td>
<td>mathematics</td>
<td>biology</td>
<td>kannada</td>
<td>sanskrit</td>
</tr>
<tr>
<td>english</td>
<td>hindi</td>
<td>computer science</td>
<td>mathematics</td>
<td>chemistry</td>
<td>physics</td>
</tr>
<tr>
<td>sanskrit</td>
<td>kannada</td>
<td>biology</td>
<td>physics</td>
<td>chemistry</td>
<td>mathematics</td>
</tr>
<tr>
<td>kannada</td>
<td>physics</td>
<td>mathematics</td>
<td>biology</td>
<td>chemistry</td>
<td>mathematics</td>
</tr>
</table>
</body>
Output: -
======end======