0% found this document useful (0 votes)
68 views44 pages

Cs Assignments

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views44 pages

Cs Assignments

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 44

Index.

html
<html>
<head>
<title>maharashtra profile</title></head>
<body text="red">
<marquee bgcolor="blue" direction="right"scrollamount="50"><h1>Maharashtra</h1>
</marquee>
<p align="center">
<img src="C:\Users\Public\Pictures\Sample Pictures\Lighthouse.jpg" height=100 width=300
border=5><br><b>Maharashtra</b>occupies the western and central part of the country
and has long coastline stretching nearly 720 kms. along the arabian sea <b> maharashtra
</b> is the <u> second </u>most popular state and <u> third </u> largest state by area in
<b> india</b>
</p><p>
<b><i>rice</b></i> is a dominant crop of the state but
b><i>cashews,mangoes,vegetables,cotton,oilseeds and tobacco </b></i> are also
important. main rivers of the state are <b><u> krishna,bhima,godavari, tapi, purna and
varda-wain ganga</b></u></p><p>
maharashtra has typical monsoon climate with hold,rainy and cold weather
seasons<big>R</big>ainfall in maharashtra differs from region to region<b><u><i> <big>
T</big>hane,<big>R</big>aigad,<big>R</big>atnagiri and <big>S</big>indudurg
districts</b></u></i>receives heavy rain of an averageof 200 c.m. annuals<big>B</big>ut
the districts of <u><i><big>N</big>ashik,<big>P</big>une,<big>A</big>hmednagar,
<big>D</big>hule,
big>J</big>algaon,<big>S</big>atara,<big>S</big>angli,<big>S</big>olapur,
and parts of <big>K</big>olhapur</u></i> gets rainfall<u>less than 50c.m. </u>
</p>
<A href="creation of website page 2.html">creation of website page 2</A><br>
</body>
</html>
<html>
<head>
<title>table</title>
</head>
<body>
<p align="center">
<img src="C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg"height=100
width=300 border=4></p>
<table border="3" bordercolor=blue align="center" >
<tr>
<th>city</th>
<th>spot to visit</th>
<th>what to see</th>
</tr>
<tr>
<th>mumbai</th>
<th>taj hotel</th>
<th>dadar</th>
</tr>
<tr>
<th>pune</th>
<th>katraj</th>
<th>j w mariott</th>
<th>
</tr>
<tr>
<th>kolhapur</th>
<th>mahalaxmi temple</th>
<th>rankala</th>
</tr>
</table>
<p align="center">
<a href="creation of website page 1.html">page1</a>
</body></html>
<html>
<body>
<table border="2" align="center">
<tr>
<th colspan=3>New Model Jr. College</td>
</tr>
<tr>
<th>subject</th>
<th>Division</th>
<th>Teacher's Name</th>
</tr>
<tr>
<th rowspan="3"> Physics</th>
<th>A</th>
<th>Mr.Shinde</th>
</tr>
<tr>
<th>B</th>
<th>Mr.Patil</th>
</tr>
<tr>
<th>C</th>
<th> Mr.Kurane</th>
<tr>
<th rowspan="3">Chemistry</th>
<th>A</th>
<th>Mr.Powar</th>
</tr>
<tr>
<th>B</th>
<th>Mr.Joshi</th>
</tr>
<tr>
<th>C</th>
<th>Mr.Patil</th>
</tr>
<tr>
<th rowspan="3">Maths</th>
<th>A</th>
<th>Mrs.Deshpande</th>
</tr>
<tr>
<th>B</th>
<th>Mr.Khot</th>
</tr>
<tr>
<th>C</th>
<th>Mr.Jadhav</th>
</tr>
</table>
</html>
<html>
<body>
<h1>Faculties</h1><hr>
<ol>
<li>Science
<ul type="disc">
<li>Physics
<li>Chemistry
<li>Maths
</ul>
<li>Commerce
<ul type="square">
<li>Accountancy
<li>Economics
<li>Organisation of Commerce
</ul>
<li>Arts
<ul type="circle">
<li>Sociology
<li>Pschology
<li>History
</ul>
</ol>
</html>
VB Program to Calculate & Display Area of Circle & Rectangle

Design Window :
Code Window :

Private Sub Command1_Click()


Text4.Text = Val(Text1.Text) * Val(Text1.Text) * 3.14
End Sub

Private Sub Command2_Click()


Text5.Text = Val(Text2.Text) * Val(Text3.Text)
End Sub

Private Sub Command3_Click()


Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
End Sub

Private Sub Command4_Click()


End
End Sub

Private Sub Form_Load()


Label1.Visible = False
Label2.Visible = False
Label3.Visible = False
Label4.Visible = False
Label5.Visible = False
Label6.Visible = False
Command1.Visible = False
Command2.Visible = False
Text1.Visible = False
Text2.Visible = False
Text3.Visible = False
Text4.Visible = False
Text5.Visible = False
End Sub
Private Sub Option1_Click()
Label2.Visible = True
Label5.Visible = True
Label3.Visible = False
Label4.Visible = False
Label6.Visible = False
Command1.Visible = True
Command2.Visible = False
Text1.Visible = True
Text4.Visible = True
Text2.Visible = False
Text3.Visible = False
Text5.Visible = False
End Sub

Private Sub Option2_Click()


Label2.Visible = False
Label5.Visible = False
Label3.Visible = True
Label4.Visible = True
Label6.Visible = True
Command1.Visible = False
Command2.Visible = True
Text1.Visible = False
Text4.Visible = False
Text2.Visible = True
Text3.Visible = True
Text5.Visible = True
End Sub
Execution :

VB Program to Add and Remove items into List & Combo Box.
Design Window :

Code Window :
Private Sub Combo1_click()
Text2.Text = Combo1
End Sub

Private Sub Command1_Click()


List1.AddItem (Text1.Text)
End Sub

Private Sub Command2_Click()


List1.RemoveItem (List1.ListIndex)
MsgBox "Item removed from the list"
End Sub

Private Sub Command3_Click()


Combo1.AddItem (Text2.Text)
End Sub

Private Sub Command4_Click()


Combo1.RemoveItem (Combo1.ListIndex)
MsgBox "Item removed from the list"
End Sub

Private Sub List1_Click()


Text1.Text = List1.Text
End Sub

Execution :
VB Program to Find Largest number amongst three numbers.
Design Window :

Code Window :
Private Sub Command1_Click()
If (Val(Text1.Text) > Val(Text2.Text) And Val(Text1.Text) > (Text3.Text)) Then
Label4.Caption = "Maximum no is" + Text1.Text
Else
If (Val(Text2.Text) > Val(Text1.Text) And Val(Text2.Text) > (Text3.Text)) Then
Label4.Caption = "Maximum no is" + Text2.Text
Else
Label4.Caption = "Maximum no is" + Text3.Text
End If
End If
End Sub

Private Sub Command2_Click()


Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Label4.Caption = ""
End Sub

Private Sub Command3_Click()


End
End Sub

Execution :
VB Program to format the Message.
Design Window :

Code Window :
Private Sub Check1_Click()
If Check1.Value = 1 Then
Label1.FontBold = True
Else
Label1.FontBold = False
End If
End Sub

Private Sub Check2_Click()


If Check2.Value = 1 Then
Label1.FontItalic = True
Else
Label1.FontItalic = False
End If
End Sub

Private Sub Check3_Click()


If Check3.Value = 1 Then
Label1.FontUnderline = True
Else
Label1.FontUnderline = False
End If
End Sub

Private Sub Form_Load()


Label1.Caption = "Welcome To VB"
End Sub

Private Sub Option1_Click()


Label1.ForeColor = vbRed
End Sub

Private Sub Option2_Click()


Label1.ForeColor = vbGreen
End Sub

Private Sub Option3_Click()


Label1.ForeColor = vbBlue
End Sub

Execution :

VB Program to display sum of first 10 nos.


Design Window :

Code Window :

Private Sub Command1_Click()


Dim i, sum As Integer
i=1
While (i <= 10)
Form1.Print i
sum = sum + i
i=i+1
Wend
Label1.Caption = "Sum of first 10 nos is" + Str(sum)
End Sub

Private Sub Command2_Click()


End
End Sub

Execution :
C++ Program to calculate Area & Circumference Of Circle.

Source :

#include<iostream.h>
#include<conio.h>
class circle
{
private:
float r;
public:
void getr();
void putr();
};
void circle::getr()
{
cout<<"Enter radius\n";
cin>>r;
}
void circle::putr()
{
float a,c;
a=3.14*r*r;
c=2*3.14*r;
cout<<"Area="<<a<<endl<<"Circumference="<<c;
}
void main()
{
circle C;
clrscr();
C.getr();
C.putr();
getch();
}
Output :
C++ Program to accept array elements to arrange them into ascending order.

Source :

#include<iostream.h>
#include<conio.h>
void main()
{
int a[100];
int n,i,j,temp;
clrscr();
cout<<"Enter the range of elements:\n";
cin>>n;
cout<<"Enter elements\n";
for(i=0;i<n;i++)
{
cin>>a[i];
}
for(i=0;i<n;i++)
{
for(j=0;j<i;j++)
{
if(a[i]<a[j])
{
temp=a[j];
a[j]=a[i];
a[i]=temp;
}
}
}
cout<<"Array in ascending order\n";
for(i=0;i<n;i++)
{
cout<<a[i]<<"\t";
}
getch();
}

OutPut :
C++ Program for Binary Search.

Source :

#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
float a[10],p;
int i,top,bot,mid;
clrscr();
cout<<"Type the elements in Ascending Order\n";
for(i=0;i<10;i++)
{
cin>>a[i];
}
top=0;
bot=9;
cout<<"Type the elements for searching\n";
cin>>p;
mid=((top+bot)/2);
while((top<=bot)&&(a[mid]!=p))
{
if(p<a[mid])
bot=mid-1;
else
top=mid+1;
mid=(top+bot)/2;
}
if(a[mid]==p)
{
cout<<"The element is at position"<<(mid+1)<<"\n";
}
else
{
cout<<"The element is not found";
}
getch();
}

OutPut :
C++ Program on Constructor & Destructor

Source :

#include<iostream.h>
#include<conio.h>
class ratio
{
public:
ratio()
{0

cout<<"Output\n";
cout<<"Object is born\n";
}
~ratio()
{
cout<<"\nObjet dies\n";
}
};
void main()
{
ratio x;
cout<<"Now X is alive\n";
cout<<"At the end of program\n";
getch();
}
Output :
C++ Program for interchanging two numbers using call by reference.

Source :

#include<iostream.h>
#include<conio.h>
void swap(int*,int*);
void main()
{
int a,b;
clrscr();
cout<<"Enter any two nos:\n";
cin>>a>>b;
swap(&a,&b);
cout<<"A="<<a<<endl<<"B="<<b;
getch();
}
void swap(int*a,int*b)
{
int t;
t=*a;
*a=*b;
*b=t;
}
Output :
C++ Program on Ratio Class.

Source :

#include<iostream.h>
#include<conio.h>
class ratio
{
private:
float num,den;
double r;
public:
void assign()
{
float n,d;
num=n;
den=d;
}
void convert()
{
float n,d;
cout<<"Enter numerator & denominator\n";
cin>>n>>d;
r=n/d;
}
void invert()
{
cout<<"\ninverse="<<"1/"<<r;
}
void print()
{
float n,d;
cout<<"Numerator="<<n<<endl;
cout<<"Denominator="<<d<<endl;
cout<<"ratio="<<r<<endl;
cout<<"ratio is 1/r="<<1/r<<endl;
}
};
void main()
{
ratio r1;
clrscr();
r1.assign();
r1.convert();
r1.print();
r1.invert();
getch();
}

Output :
C++ Program on Inheritance.

Source :
#include<iostream.h>
#include<conio.h>
class student
{
protected:
int rno;
public:
void getrno();
void putrno();
};
void student::getrno()
{
cout<<"Enter rno=";
cin>>rno;
}
void student::putrno()
{
cout<<"Rollno="<<rno<<endl;
}
class test:public student
{
protected:
int s1,s2;
public:
void getmarks();
void putmarks();
};
void test::getmarks()
{
cout<<"Enter marks\n";
cin>>s1>>s2;
}
void test::putmarks()
{
cout<<"\nMarks are of two subjects\n";
cout<<s1<<endl<<s2;
}
class sport:public test
{
protected:
int s;
public:
void getsports();
void putsports();
};
void sport::getsports()
{
s=25;
}
void sport::putsports()
{
cout<<"\nSports marks are ="<<s<<endl;
}
class result:public sport
{
float total;
public:
void display();
};
void result::display()
{
total=s1+s2+s;
putrno();
putmarks();
putsports();
cout<<"\nTotal="<<total;
};
void main()
{
result R;
clrscr();
R.getrno();
R.getmarks();
R.getsports();
R.display();
getch();
}

Output :
C++ Program on File Handling
Source :
#include<fstream.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
const int size=80;
char line[size];
clrscr();
ofstream fout;
fout.open("country");
fout<<"\nUnited States of America";
fout<<"\nUnited Kingdom";
fout<<"\nSouth Korea";
fout<<"\nIndia";
fout<<"\nPakistan";
fout.close();
fout.open("capital");
fout<<"\nWashington D.C.";
fout<<"\nLondon";
fout<<"\nSeoul";
fout<<"\nNew Delhi";
fout<<"\nIslamabad";
fout.close();
ifstream fin1,fin2;
fin1.open("country");
fin2.open("capital");
cout<<"Country\t\t\tCapital\n\n";
for(int i=1;i<=10;i++)
{
if(fin1.eof()!=0)
{
cout<<"Exit from country\n";
exit(1);
}
fin1.getline(line,size);
cout<<line<<"\t\t\t";
if(fin2.eof()!=0)
{
cout<<"Exit from capital\n";
exit(1);
}
fin2.getline(line,size);
cout<<line<<"\n";
}
getch();
}
OutPut :

You might also like