Sunteți pe pagina 1din 13

Experiment list

1. Study and Practice of MS windows- Folder Related Operations, My computer, Window Explorer, Control panel. 2. Study and Practice of Internal and External DOS Commands. 3. Creation and Editing of Text Files using MS-word. 4. Creation and Operating of spreadsheet using MS-Excel. 5. Creation and Editing of Power point slides using MS-Power point. 6. Creation and Manipulation of Database Table using SQL in MS Access. 7. Write program to print hello. #include<iostream.h> #include<conio.h> void main() { clrscr(); cout<<"\t Hello student"; getch(); } o/p:- Hello student 8. Write a program to calculate SI. #include<iostream.h> #include<conio.h> void main() { clrscr(); int p ,r,t; float SI; cout<<"Enter the value of p\t r\t t"; cin>>p>>r>>t; SI=(p*r*t)/100; cout<<"\n the SI is "<<SI; getch(); } o/p:- Enter the value of p 1000 1 1 the SI is 10 r t

9. Write a program to find that the no. is even or odd.(if-else) #include<iostream.h> #include<conio.h> void main() { clrscr(); int num; cout<<"\n enter the value of num:"; cin>>x; if (num%2==0) { cout<<"/n number is even"; } else { cout<<"/n number is odd"; } getch(); } o/p:- enter the value of num: 10 number is even

10. Write a program to find day of a week using switch-case.


#include<iostream.h> #include<conio.h> void main() { clrscr(); int day; cout<<"Enter day number"; cin>>day ; switch(day) { case 0: { cout<<" \t SUNDAY"; break; } case 1: { cout<<" \t MONDAY"; break; } case 2: {

cout<<" \t TUEDAY"; break; } case 3: { cout<<" \t WEDDAY"; break; } case 4: { cout<<" \t THUDAY"; break; } case 5: { cout<<"\t FRIDAY"; break; } case 6: { cout<<"\t SATDAY"; break; } default: { cout<<wrong choice...Please try again...."; } } getch(); }

o/p:- Enter day number 1 MoNDAY 11. Write a program to show concept of conditional operator. #include<iostream.h> #include<conio.h> void main() { clrscr(); int a,b,c; cout<<"Enter the value of a and b"; cin>>a>>b; c=(a>b)? a:b; cout<<"the greater value is \t"<<c; getch(); } o/p:- Enter the value of a and b 10 20 the greater value is 20 12. Write a program to print number from 1 to N using while loop. #include<iostream.h> #include<conio.h> void main() { int n,i=1;

cout<<"enter the last number of the series:"; cin>>n; while(i<=n) { cout<<" "<<i; i++ ; } getch(); } o/p:- enter the last number of the series: 10 1 2 3 4 5 6 7 8 9 10 13. Write a program to show difference between while and do while loop. #include<iostream.h> #include<conio.h> void main() { clrscr(); cout<<"\n******** this is Do-While output *********\n"; do { cout<<"\n do while loop execute set of statement \n at least one time while codition is wrong\n \n"; } while(6>10); cout<<"\n******** this is while output

*********";

while(6>10) { cout<<"\n while loop execute none statement while codition is wrong"; } getch(); } o/p:- ******** this is Do-While output

*********

do while loop execute set of statement at least one time while codition is wrong ******** this is while output *********

14. Write a program to find out factorial of a given no. using for loop. #include<iostream.h> #include<conio.h> void main() { int num,fact=1,i; cout<<"enter the no whose factorial you want to find out; cin>>num;

for(i=0;i<=num;i++) { fact=fact*i; } cout<<"the factorial of "<<num<<"is:"<<fact; getch(); } o/p:- enter the no whose factorial you want to find out 3 the factorial of 3 is 6 15. Write a program to create an array of marks of 10 students and find total marks of 10 students.
#include<iostream.h> #include<conio.h> void main() { clrscr(); int Marks[10],i,sum=0; cout<<"enter marks of 10 students\n\n"; for(i=0;i<=9;i++)//enter marks of student { cin>>Marks[i]; } cout<<"\n\nMarks of 10 students are\n\n"; for(i=0;i<=9;i++)//display marks of student { cout<<Marks[i]<<" "; } cout<<"\n\naddition of Marks of 10 students is="; for(i=0;i<=9;i++) { sum=sum+Marks[i]; } cout<<sum; getch(); } o/p:- enter marks of 10 students 10 20 30 40 50 60 70 80 10 30 Marks of 10 students are 10 20 30 40 50 60 70 80 10 30 addition of Marks of 10 students is= 400

16. Write a program to create a function for adding, subtracting, multiplying and division of a two numbers #include<iostream.h> #include<conio.h> //funtion's declaration void add(); void sub(int,int);

int mul(int,int); int div(); //funtion's defination //****No return type & No parameter *** void add() { int a,b,c; cout<<"\n enter value for addition"; cin>>a>>b; c=a+b; cout<<"sum="<<c<<"\n"; } //*** No return type with parameter **** void sub(int p,int q) { int r; cout<<"enter the value for subtraction"; cin>>p>>q; r=p-q; cout<<"\nthe Subtraction is"<<r<<"\n" ; } //**** Return type with parameter *** int mul(int x,int y) { int z; cout<<"enter the value for multiplication"; cin>>x>>y; z=x*y; return(z); } int div () { int m,n,o; cout<<"\n Enter value for division"; cin>>m>>n; o=m/n; return(o); } //funtion's calling void main() { clrscr(); int x,y,p,q; add(); sub(p,q); cout<<"multiply="<<mul(x,y)<<"\n"; cout<<"the division is"<<div(); getch(); } 17. Write a program for swapping two numbers through call by value (pass by value).

#include<iostream.h> #include<conio.h> void swap(int ,int);//function declaration or fuction protyping void swap(int x,int y) //fuction definition { int z; z=x; x=y; y=z; } void main() { clrscr(); int a,b; cout<<"enter value of a and b\n"; cin>>a>>b; cout<<"\nvalues before swapping\n"; cout<<"a=" <<a<<" b="<<b<<"\n\n"; swap(a,b);//function calling cout<<"\nvalues after swapping\n"; cout<<"a=" <<a<<" b="<<b<<"\n\n"; getch(); } o/p:- enter value of a and b 56 89 values before swapping

a=56 b=89
values after swapping

a=56 b=89

18. Write a program for swapping two numbers through pass by reference (call by reference) .
#include<iostream.h> #include<conio.h> void swap(int &,int &)//function declaration or fuction protyping void swap(int &x,int &y) //fuction definition { int z; z=x; x=y; y=z; } void main() { clrscr(); int a,b; cout<<"enter value of a and b\n"; cin>>a>>b; cout<<"\nvalues before swapping\n"; cout<<"a=" <<a<<" b="<<b<<"\n\n"; swap(a,b); //function calling cout<<"\nvalues after swapping\n"; cout<<"a=" <<a<<" b="<<b<<"\n\n"; getch(); } enter value of a and b 56

89 values before swapping

a=56 b=89
values after swapping

a=89 b=56

19. Write a program for swapping two numbers through pass by address (call by address) or pass by pointer(call by pointer).
#include<iostream.h> #include<conio.h> void swap(int *,int *)&)//function declaration or fuction protyping void swap(int *x,int *y) //fuction definition { int z; z=*x; *x=*y; *y=*z; } void main() { clrscr(); int a,b; cout<<"enter value of a and b\n"; cin>>a>>b; cout<<"\nvalues before swapping\n"; cout<<"a=" <<a<<" b="<<b<<"\n\n"; swap(&a,&b); //function calling cout<<"\nvalues after swapping\n"; cout<<"a=" <<a<<" b="<<b<<"\n\n"; getch(); } enter value of a and b 56 89 values before swapping

a=56 b=89
values after swapping

a=89 b=56

20. Write a program to show the concept of structure.


#include<iostream.h> #include<conio.h> struct Emp { char name[50]; int age; char quali[70]; int teleno; }emp1; void main() { clrscr(); Emp emp2; cout<<memory occupied by emp2 is =<<sizeof(emp2)<<\n\n; cout<<"enter name of the employ"<<endl; cin>>emp1.name;

cout<<"enter age of the employ"<<endl; cin>>emp1.age; cout<<"enter qualification of the employ"<<endl; cin>>emp1.quali; cout<<"enter telephone no of the employ"<<endl; cin>>emp1.teleno; emp2=emp1; cout<<"\n\nInformation of employee\n\n"; cout<<"the name of emp:"<<emp2.name<<endl; cout<<"the age of emp:"<<emp2.age<<endl; cout<<"qualification of the emp:"<<emp2.quali<<endl; cout<<"the teleno of emp:"<<emp2.telno<<endl; //return(0); getch(); } o/p:memory occupied by emp2 is =124 enter name of the employ shweta enter age of the employ 27 enter qualification of the employ B.E enter telephone no of the employ 9519086672 Information of employee the name of emp:shweta the age of emp:27 qualification of the emp:B.E the teleno of emp:9519086672

21. Write a program to show the concept of union.


#include<iostream.h> #include<conio.h> union Emp { char name[50]; int age; char quali[70]; int teleno; }emp1; void main() { clrscr(); Emp emp2; cout<<memory occupied by emp2 is =<<sizeof(emp2)<<\n\n; cout<<"enter name of the employ"<<endl; cin>>emp1.name; cout<<"enter age of the employ"<<endl; cin>>emp1.age; cout<<"enter qualification of the employ"<<endl; cin>>emp1.quali; cout<<"enter telephone no of the employ"<<endl; cin>>emp1.teleno; emp2=emp1; cout<<"\n\nInformation of employee\n\n";

cout<<"the name of emp:"<<emp2.name<<endl; cout<<"the age of emp:"<<emp2.age<<endl; cout<<"qualification of the emp:"<<emp2.quali<<endl; cout<<"the teleno of emp:"<<emp2.telno<<endl; //return(0); getch(); } memory occupied by emp2 is =70 enter name of the employ shweta enter age of the employ 27 enter qualification of the employ B.E enter telephone no of the employ 9519086672 Information of employee the name of emp:shweta the age of emp:27 qualification of the emp:B.E the teleno of emp:9519086672

22. Write a program to print name, age and salary of a employee using class and object.
#include<iostream.h> #include<conio.h> class employee { char name[20]; int age; int salary; public: void get_value() { cout<<"enter the information regarding employee\n\n"; cout<<" enter name of employee \n"; cin>>name; cout<<"enter age of employee\n"; cin>>age; cout<<"enter salary of employee\n"; cin>>salary; } void display() { cout<<"\n\ninformation of employee\n\n"; cout<<"Name="<<name<<"\n"; cout<<"Age="<<age<<"\n"; cout<<"Salary="<<salary<<"\n"; } }; void main() { clrscr(); employee emp1; emp1.get_value(); emp1.display();

getch(); } o/p:- enter the information regarding employee enter name of employee Sarita enter age of employee 27 enter salary of employee

12000
information of employee Name=Sarita Age=27 Salary=12000

23. Write a program to show concept of constructor and destructor.


#include<iostream.h> #include<conio.h> class x { int a,b; public: x() //constructor definition { cout<<"contructor call as soon as object of class is created\n\n"; a=0; b=0; } void get() { cout<<"\n\nenter vale of a and b\n"; cin>>a>>b; } void display() { cout<<"\n\nvalues of a and b are:\n\n"; cout<<"a="<<a<<"\n"<<"b="<<b<<"\n"; } ~x() { cout<<"\n\ndestructor called when object memery relese"; } }; void main() { clrscr(); x x1; x1.display(); x1.get(); x1.display(); getch(); } o/p:- contructor call as soon as object of class is created values of a and b are: a=0

b=0
enter vale of a and b 12 45

values of a and b are: a=0

b=0
destructor called when object memery relese(after pressing Alt+f5)

24. Write a program to show concept of function overloading.


#include<conio.h> #include<iostream.h> void add(int ,int);//fuction add with two intetger parameter float add(int,float);//fuction add with one intetger andonefloatparameter void add(int,double);//fuction add with one intetger andonedoubleparameter void add(int a,int b) { int z; z=a+b; cout<<"addtion of two interger no.is="<<z<<"\n"; } float add(int a,float b) { int z; z=a+b; return (z); } void add(int a,double b) { int z; z=a+b; cout<<"addtion of one interger and one double no.is="<<z<<"\n"; } void main() { clrscr(); float z; add(10,20); z=add(10,12.34f); cout<<"addtion of one interger and one float no.="<<z<<"\n"; add(10,34.78); getch(); } o/p:- addtion of two interger no.is=30 addtion of one interger and one double no.is=22 addtion of one interger and one float no.=44

25.Write a program to show concept of single inheritance.


#include<iostream.h> #include<conio.h> class base { public: void base_display() { cout<<"this is base class function\n\n"; } }; class derive:public base { public: void derive_display() {

cout<<"this is derive class function\n\n"; } }; void main() { clrscr(); base b; //b can call only base class functions i.e base_diplay() b.base_display(); //b.derive_display(); //occur an error derive d;//d can call derive class fuctions as well as base class functions d.base_display(); d.derive_display(); getch(); } o/p:- this is base class fuction this is base class function this is derive class function

S-ar putea să vă placă și