0% found this document useful (0 votes)
5 views17 pages

CS1 Program Prints

The document contains various programming examples and HTML files created by Aditya Yadav, showcasing skills in web development, C++, and Visual Basic. It includes HTML code for a webpage, C++ programs for array manipulation, string reversal, and class implementation, as well as Visual Basic code for shape selection and area calculation. Each section is labeled with the author's name and roll number, demonstrating a range of programming concepts and outputs.

Uploaded by

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

CS1 Program Prints

The document contains various programming examples and HTML files created by Aditya Yadav, showcasing skills in web development, C++, and Visual Basic. It includes HTML code for a webpage, C++ programs for array manipulation, string reversal, and class implementation, as well as Visual Basic code for shape selection and area calculation. Each section is labeled with the author's name and roll number, demonstrating a range of programming concepts and outputs.

Uploaded by

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

ADITYA YADAV

ROLL NO 37

FILE 1: FIRST.HTML
<HTML>
<HEAD> <TITLE> MY WEB PAGE </TITLE> </HEAD>
<BODY BOCOLOR "yellow">
<H1> <CENTER> NEW TECH PRIVATE LIMITED </CENTER> </H1>
<P>
<FONT COLOR= "Blue" SIZE="6" FACE= "MONOTYPE CORSIVA"> One of the leading software
company is New Tech Private Limited. It was established in the year 1998. And since its inception, it
has been growing day by day. Today it is one of the best Software development company.
</FONT>
</P>
<P>
<FONT COLOR= "green" SIZE="5" FACE= "arial"> Working in IT is one of the world's most
challenging jobs-which is sometimes bad and sometimes good. New Tech makes it possible to enjoy
challenges.
</FONT>
</P>
<P> <FONT COLOR="red" SIZE="3" FACE= "Times new roman"> To get things done these days,
working in teams is almost imperative. New Tech has a strong team with motivating leaders which is
the root cause why the company is touching the sky.
</FONT>
</P>
<A HREF= "C:\SECOND.HTML"> CLICK HERE TO GOTO NEXT PAGE </A>
</BODY>
</HTML>

FILE 2: C:\SECOND.HTML
<HTML>
<BODY BGCOLOR="Green">
<MARQUEE> HELLO WORLD!!!</MARQUEE>
THIS IS THE SECOND FILE.
</BODY>
</HTML>
OUTPUT:
ADITYA YADAV
ROLL NO 37

<Html>
<Title> My Web Page </Title>
<Body Bgcolor="pink">
<h2><marquee> Welcome to my page </marquee></h2>
<br><br>
<table border="1">
<tr>
<td colspan="2">Computer Science</td>
<td colspan="2">Physics</td>
<td colspan="2">Chemistry</td>
</tr>
<tr>
<td>Theory</td>
<td >Pracs</td>
<td>Theory</td>
<td >Pracs</td>
<td>Theory</td>
<td >Pracs</td>
</tr>
<tr>
<td >80</ td >
<td >60</ td >
<td >50</ td >
<td >60</ td >
<td >80</ td >
<td >70</td>
</tr>
<tr>
<td >50</ td >
<td >60</ td >
<td >35</ td >
<td >47</ td >
<td >75</ td >
<td >46</ td >
</tr>
</table>
<br><br>
<A href = "c:\First.html">
<img src="d:\pic1.jpg" alt="picture file" width=200 height =200></ img ></A>
</Body
</Html>
ADITYA YADAV
ROLL NO 37

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float a[]={10.2,3.9, 4.6, 5.5, 6.9};
float *ptr, sum=0;
ptr=a;
cout<<endl<<"Starting Address\tSize\tEnding Address\t\tValue of Sum";
for(int i=0;i<5;1++)
{
sum=sum+*ptr;
cout<<endl<<ptr<<"\t\t"<<sizeof(*ptr)<<"\t";
}
ptr=ptr+1;
cout<<ptr<<"\t\t"<<sum;
getch();
}
output:
Starting Address Size of Element Ending Address Value of
Sum
0x7ffcd1a81d80 4 0x7ffcd1a81d84 10.2
0x7ffcd1a81d84 4 0x7ffcd1a81d88 14.1
0x7ffcd1a81d88 4 0x7ffcd1a81d8c 18.7
0x7ffcd1a81d8c 4 0x7ffcd1a81d90 24.2
0x7ffcd1a81d90 4 0x0 31.2
ADITYA YADAV
ROLL NO 37

#include<stdio.h>
#include<conio.h>
#include<iostream.h>
#include<string.h>
void main()
{
clrscr();
char S[100], temp;
cout<<endl<<"Enter the string : ";
cin.getline(S, 100);
int len=strlen(S);
int I=len-1;
for(int i=0; i<len/2; i++)
{
temp = S[i];
S[i] = S[I];
S[I] = temp;
I--;
cout<<endl<<"Reverse String: "<<S;
}
getch();
}
output:
Enter the string: Hello World
Reversed String: dlroW olleH
ADITYA YADAV
ROLL NO 37

Private Sub combo1_Click()


If combo1.Text = "Circle" Then
Label3.Visible = False
Label4.Visible = False
text3.Visible = False
text2.Visible = False
shape1.Shape = 3 ' Assuming 3 represents a Circle shape
shape1.Visible = True
shape2.Visible = False
ElseIf combo1.Text = "Rectangle" Then
Label2.Visible = False
text1.Visible = False
shape1.Shape = 0 ' Assuming 0 represents a Rectangle shape
shape2.Visible = True
shape1.Visible = False
End If
End Sub
Private Sub combo1_Click_Area()
Dim a As Double
If combo1.Text = "Circle" Then
a = 3.14 * Val(text1.Text) * Val(text1.Text)
MsgBox("Area is " & a)
ElseIf combo1.Text = "Rectangle" Then
a = Val(text2.Text) * Val(text3.Text)
MsgBox("Area is " & a)
End If
End Sub
Private Sub command_Click()
text1.Text = ""
text2.Text = ""
text3.Text = ""
End Sub
output:
Area is 78.5
ADITYA YADAV
ROLL NO 37

Private Sub command_Click()


Dim I As Integer, sum As Integer
sum = 0
I=1
Do
List1.AddItem(I)
sum = sum + I
I=I+1
Loop Until I > 100
text1.Text = sum
End Sub
Private Sub label_Click()
End Sub
output:
5050
1
2
3
...
100
ADITYA YADAV
ROLL NO 37

#include<iostream.h>
# include<conio.h>
int bsearch(int[],int ,int);
void main()
{
clrscr( );
int a[10],i,d,loc;
cout<<"Enter any 10 Numbers in Ascending Order: ";
for(i=0;i<10;i++)
{
cin>>a[i];
}
cout<<"Enter the Number to be Searched: ";
cin>>d;
loc=bsearch(a ,d ,i);
if(loc!=-1)
{
cout<<endl<<"Number is found at Index: "<<loc;
}
else
{
cout<<endl<<"Number could not be found";
}
getch();
}
int bsearch(int y[], int dt, int I)
{
int mid, lb, ub;
lb = 0;
ub = I – 1;
while (ub >= 1b)
{
mid=(ub+lb)/2;
if(y[ mid] == dt )
{
return mid;
}
else if(y[mid] < dt)
{
lb = mid + 1;
}
else
{
ub= mid -1;
}
}return 0;}
output:
Enter any 10 numbers in Ascending Order: 2 5 8 12 15 20 25 30 35 40
Enter the number to be searched: 15
ADITYA YADAV
ROLL NO 37

#include<iostream.h>
#include<conio.h>
int main( )
{
clrscr ( )
int a[10],i,j,temp;
cout<<"Enter the Elements of the Array: ";
for(i=0;i<10;i++)
{
cin>>a[i];
}
cout<<"Original Array: ";
for(i=0;i<10;i++)
{
cout<<a[i]<<" ";
} cout<<endl;

for(i=0;i<10-1;i++)
{
for(j=0;j<10-i-1;j++)
{
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
cout<<endl<<”After Bubble short ascending order: “<<endl ;
for(i=0;i<10;i++)
{
cout<<a[i]<<" ";
}
cout<<endl;
getch();
}
output:
Original Array: 5 3 8 4 2 9 1 6 7 0
After Bubble Sort in ascending order:
0123456789
ADITYA YADAV
ROLL NO 37

#include<iostream.h>
#include<conio.h>
class student {
protected:
int roll_no;
public:
void get_no(int a) {
roll_no=a;
}
void put_no(void) {
cout<<endl<<"Roll No: "<<roll_no;
}
};
class test:public student {
protected:
float part1,part2;
public:
void get_marks(float x, float y) {
part1=x;
part2=y;
}
void put_marks(void)
cout<<endl<<endl<<"Marks Obtained: ";
cout<<endl<<"Part 1: "<<part1;
cout<<endl<<"Part 2: "<<part2;
}
};
class sports {
protected:
float score;
public:
void get score(float s) {
score=s;
}
void put_score(void){
cout<<endl<<"Score: "<score;
}
};
class result: public test, public sports {
protected:
float total;
public:
void display(void); {
total=part1+part2+score;
put_no();
put_marks();
put_score();
cout<<endl<<endl<<"Total: "<<total;
}
};
void main() {
clrscr();
result r;
r.get_no(8);
r.get_marks(83.7,84.0);
r.get_score(83.4);
r.display();
getch();
}
output:
Roll No: 8
Marks Obtained:
Part 1: 83.7
Part 2: 84
Score: 83.4
Total: 251.1
ADITYA YADAV
ROLL NO 37

#includeciostream.h>
#include<conio.h>
class complex
{
private:
float x;
public:
float y;
complex(){}
complex(float real, float imag);
complex operator + (complex C);
void display(void);
};
complex::complex( (float real, float imag)
x=real;
y=imag;
}
void complex::display(void)
{
cout<<x<<”+”<<y<<"i"<<endl;
}
complex complex :: operator +(complex C)
{
complex temp;
temp.x=x+C.x;
temp.y=y+C.y
return temp;
}
void main()
{
clrscr();
complex C1,C2,C3;
C1=complex(0.7,6.9);
C2=complex(1.1,1.7);
C3=C1+C2;
cout<<"C1: "
C1.display();
cout<<endl<<"C2: ";
C2.display();
cout<<endl<<"C3(C1+C2): ";
C3.display();
getch();
}
output:
C1: 0.7+6.9i
C2: 1.1+1.7i
C3 (C1 + C2): 1.8+8.6i
ADITYA YADAV
ROLL NO 37

#include<fstream.h>
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
ofstream fout;
fout.open("Country");
fout<<endl<<"United States of America";
fout<<endl<<"United Kingdom";
fout<<endl<<"South Korea";
fout.close();
fout.open("Capital");
fout<<endl<<"Washington D.C.";
fout<<endl<<"London";
fout<<endl<<"Seoul";
fout.close();
const int n=80;
char line[n];
ifstream fin;
fin.open("Country");
cout<<"Content of Country";
while(fin.getline(line,n))
{
cout<<"\t"<<line<<endl;
}
fin.close();
fin.open("Capital");
cout<<endl<<"Content of Capital";
while(fin.getline(line, n))
{
cout<<"\t"<<line<<endl;
}
fin.close();
getch();
}
output:
Content of Country:
United States of America
United Kingdom
South Korea
Content of Capital:
Washington D.C.
London
Seoul
ADITYA YADAV
ROLL NO 37

Private Sub Command1_Click()


MsgBox Text1.Text & " " & Text2.Text
MsgBox Text3.Text & " " & Text4.Text
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text4.SetFocus
End If
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub
output:
John Doe
25 Male
ADITYA YADAV
ROLL NO 37

#include<iostream.h>
#include<conio.h>
class ratio {
public:
ratio() {
cout<<"The object is born";
}
void print() {
cout<<"\nNow object is alive";
}
~ratio() {
cout<<"\nNow object has died";
}
};
void main()
{
clrscr();
ratio r;
r.print();
getch();
}
output:
The object is born
Now object is alive
Now object has died
ADITYA YADAV
ROLL NO 37

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b;
cout<<"Enter any two Number: ";
cin>>a>>b;
cout<<endl<<"Number before Swapping: ";
cout<<endl<<"a: "<<a;
cout<<endl<<"b: "<<b;
swap(&a,&b);
cout<<endl<<"Number after Swapping: ";
cout<<endl<<"a: "<<a;
cout<<endl<<"b: "<<b;
getch();
}
void swap(int *p1, int *p2)
{
int temp;
temp=*p1;
*p1=*p2;
*p2=temp;
cout<<"Swapping in Function: "<<*p1<<" , "<<*p2<<endl;
}
output:
Enter any two numbers: 10 20
Numbers before swapping:
a: 10
b: 20
Swapping in Function: 20, 10
Numbers after swapping:
a: 20
b:10
ADITYA YADAV
ROLL NO 37

#include<iostream.h>
#include<conio.h>
class Ratio
{
int num, den;
public:
void assign();
void convert();
void invert();
void print();
}
void Ratio::assign() {
cout<<"Enter numerator: ";
cin>>num;
cout<<"Enter denominator: ";
cin>>den;
}
void ratio::convert()
{
cout<<"The Ratio: "<<double(num)/double(den)<<endl;
}
void Ratio::invert()
{
int temp;
temp=num;
num-den;
den=temp;
}
void Ratio::print()
{
cout<<num<<"/"<<den<<endl;
}
void main()
{
clrscr();
ratio r;
r.assign();
r.convert();
r.invert();
cout<<"After inverting the ratio: ";
r.print();
getch();
ADITYA YADAV
ROLL NO 37

}
output:
Enter numerator: 3
Enter denominator: 4
The ratio: 0.75
After inverting the ratio: 4/3
#include<iostream.h>
#include<conio.h>
class circle
{
private:
float r,a,c,x,y;
public:
circle() {
r=7;
x=6;
y=8;
}
void area() {
a=3.14*r*r;
}
void circum()
c=2*3.14*r;
}
void print()
{
cout<<"The radius of the Circle: "<<r<<endl;
cout<<"The x, y co-ordinates of center: "<<x<<”,”<<y<<endl;
cout<<"The Area of Circle: "<<a<<endl;
cout<<"The circumference of circle: "<<c;
}
};
void main()
{
clrscr();
circle C;
C.area();
C.circum();
C.print();
getch();
}
output:
The radius of the Circle: 7
The x, y coordinates of center: 6,8
The Area of Circle: 153.86
The circumference of circle: 43.96
ADITYA YADAV
ROLL NO 37

#include<iostream.h>
#include<conio.h>
class person
{
public:
virtual void print()
{
cout<<"\nThe name of the person is BOB";
}
};
class studnet: public person
{
public:
void print()
{
cout<<"\nThe name of the student is TOM";
}
};
void main()
{
clrscr();
person *p,p1;
p=&p1;
p->print();
student s1;
p=&s1;
p->print();
getch();
}
output:
The name of the person is BOB
The name of the student is TOM

You might also like