0% found this document useful (0 votes)
19 views13 pages

11th CS1 Practical PDF

The document contains a series of practical exercises aimed at teaching C++ and Visual Basic programming concepts. Each practical includes an aim, code snippet, and output description, covering topics such as structures, operators, loops, arrays, functions, and GUI elements. The exercises are designed to provide hands-on experience with fundamental programming techniques.

Uploaded by

Sagar Jha
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)
19 views13 pages

11th CS1 Practical PDF

The document contains a series of practical exercises aimed at teaching C++ and Visual Basic programming concepts. Each practical includes an aim, code snippet, and output description, covering topics such as structures, operators, loops, arrays, functions, and GUI elements. The exercises are designed to provide hands-on experience with fundamental programming techniques.

Uploaded by

Sagar Jha
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/ 13

PRACTICAL 1

AIM:Write C++ code to study C++ structure.


CODE:
#include<iostream.h>

#include<conio.h>
void main()
{
clrscr();
cout<<"Welcome to C++"<<endl;

getch();
}

OUTPUT:
PRACTICAL 2
AIM:Write C++ code to use operator.
CODE:
#include<iostream.h>

#include<conio.h>

void main()

clrscr();

int a,b,add,sub,mul,div;

cout<<"enter 2 Numbers:";

cin>>a>>b;

add=a+b;

sub=a-b;

mul=a*b;

div=a/b;

cout<<"Addition="<<add<<endl;

cout<<"Subtraction="<<sub<<endl;

cout<<"Multiplication="<<mul<<endl;

cout<<"Division="<<div<<endl;

getch();

OUTPUT:
PRACTICAL 3
AIM:Write C++ code to print 1 to 10 using for loop
CODE:
#include<iostream.h>

#include<conio.h>

void main()

clrscr();

for(int i=1;i<=10;i++)

cout<<i<<endl;

getch();

OUTPUT:
PRATICAL 4
AIM:Write C++ code for following pattern
*
**
***
****`
Code:
#include<iostream.h>

#include<conio.h>

void main ()

clrscr();

for(int i=1;i<=4;i++)

for(int j=1;j<=i;j++)

cout<<"* ";

cout<<"\n";

getch();

OUTPUT:
PRACTICAL 5
AIM:Write C++ code to find maximum number between two
numbers using if else statement
CODE:
#include<iostream.h>

#include<conio.h>

void main()

clrscr();

int a,b;

cout<<"enter two number";

cin>>a>>b;

if(a>b)

cout<<a<<" is maximum";

else

cout<<b<<" is maximum"; B

getch();

OUTPUT:
PRACTICAL 6
AIM:write C++ Program to study ARRAYS
CODE:
#include<iostream.h>

#include<conio.h>

void main()

clrscr();

int a[5], i;

cout << "Enter 5 numbers: ";

for(i=0; i<5; i++)

cin >> a[i];

cout << "\nThe 5 numbers are: ";

for(i=0; i<5; i++)

cout << "\t" << a[i];

getch();

}
PRACTICAL 7
AIM:Write C++ code to study function
CODE:
#include<iostream.h>

#include<conio.h>

float area(int r);

void main()

clrscr();

int r;

cout<<"Enter Radius";

cin>>r;

cout<<"Area of Circle="<<area(r);

getch();

float area(int r)

float a;

a=3.14*r*r;

return a;

OUTPUT:
PRACTICAL 8
AIM: Write a visual basic code to find area of circle
CODE:
Private Sub Command1_Click()
Text2.Text = 3.14 * Val(Text1.Text) * Val(Text1.Text)
End Sub

Private Sub Command2_Click()


Text1.Text = " "
Text2.Text = " "
End Sub

Private Sub Command3_Click()


End
End Sub

OUTPUT:
Properties:
Sr.no. Control Property Value
type
1 Label Name Label1

Caption Enter the Radius

2 Label Name Label2

Caption Area of circle

3 TextBox Name Text1

Text

4 TextBox Name Text2

Text

5 Command Name Command1


Button
Caption Area

6 Command Name Command2


Button
Caption Clear

7 Command Name Command3


Button
Caption End
PRACTICAL 9
AIM:- Write a program in Visual Basic to find the sum of first 100 numbers
entered using Do loop.

Code:
Private Sub command1_Click()

Dim i, 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

Output:
Properties:
Sr.no. Control Property Value
type
1 Label Name Label1

Caption TOTAL

2 ListBox Name List1

3 TextBox Name Text1

Text

4 Command Name Command1


Button
Caption CLICK TO ADD
NUMBERS TO LIST
PRACTICAL 10
AIM:- Create a graphic editor using Visual Basic, which has the following
functions : change color, change border width, change border color etc.

Code:
Private Sub Option1_Click()

Shape1.BackColor = vbRed

End Sub

Private Sub Option2_Click()

Shape1.BackColor = vbGreen

End Sub

Private Sub Option3_Click()

Shape1.BackColor = vbBlue

End Sub

Private Sub Option4_Click()

Shape1.BorderColor = vbRed

End Sub

Private Sub Option5_Click()

Shape1.BorderColor = vbGreen

End Sub

Private Sub Option6_Click()

Shape1.BorderColor = vbBlue

End Sub

Private Sub Option7_Click()

Shape1.BorderWidth = 2

End Sub

Private Sub Option8_Click()

Shape1.BorderWidth = 5

End Sub

Private Sub Option9_Click()


Shape1.BorderWidth = 7

End Sub

OUTPUT:

Properties:
Sr.no. Control types Property Value
1 Shape Name Shape1
BackStyle Opaque
2 Frame Name Frame1
Caption Background
color
3 Option Button Name Option1
4 Option Button Name Option2
5 Option Button Name Option3
6 Frame Name Frame2
Caption Border color
7 Option Button Name Option4
8 Option Button Name Option5
9 Option Button Name Option6
10 Frame Name Frame3
Caption Border Width
11 Option Button Name Option7
12 Option Button Name Option8
13 Option Button Name Option9

You might also like