Skip to main content

Posts

Showing posts from April, 2009

Extra in OOP_C++

/* Scientific Calculator */ #include #include #include #include #include #include #include double rfact(double); void main() { int ch; int k,n,choice; float sinx,cosx,tanx,cotx,secx,cosecx; float x,j,i; clrscr(); cin>>ch; if(ch==4444) { int gdriver=DETECT,gmode, errorcode; initgraph(&gdriver,&gmode,"e:\\tc\\bgi"); setbkcolor(LIGHTRED); settextstyle(7,0,9); outtextxy(45,160,"..WELCOME!..");//page1 getch(); closegraph(); } getch(); clrscr(); textcolor(YELLOW+128); gotoxy(30,12); cprintf("COMPUTER EXHIBITION\n\r");//page2 textcolor(GREEN); gotoxy(30,14); cprintf(" Dhanoop Bhaskar \n\r"); textcolor(BLUE); gotoxy(30,15); cprintf(" C2 Batch\n\r"); textcolor(CYAN); gotoxy(30,16); cprintf(" CARDINAL .HSS\n\r "); textcolor(RED+128); gotoxy(33,19); cprintf("INSTRUCTIONS:\n\r"); textcolor(YELLOW); gotoxy(22,20); cprintf("\(The Scientific Calculator enables to\n\r"); gotoxy(22,21); cprintf("F...

Review Questions

Chapter I: Principles of Object-Oriented Programming 1. Which of the following languages is not a procedure-oriented programming language? a) ALGOL b) COBOL c) FORTRAN d) None of the above 2. Which of the following programming approach used functions as a key concept to perform action-oriented tasks? a) Structured programming b) Modular programming c) Procedure-oriented programming d) Object-oriented programming 3. Identify the drawback of using procedure-oriented programming, if any: a) Data is hidden from external functions b) New functions can be added whenever necessary c) Does not reflect real world problems d) All of the above 4. Which is not associated with Object-oriented programming? a) Data abstraction b) Automatic initialization c) Dynamic binding d) None 5. The term operator overloading in C++ refers to: a) Inheritance b) Message passing c) Polymorphism d) None 6. Which one of the following OOP concepts enables reusability of components? a) Inheritance b) Encapsulation c) P...

...DATA STRUCTURE PROGRAMS IN C++...

................................................................................................. NB: To rectify problems associated with html coding white spaces are provided in statements especially after " Email your suggestions and feedbacks to Enjoy programming ................................................................................................. Aim: Write a C++ program to find the sparse of a matrix PROGRAM #include”iostream.h” #include”conio.h” void main() { int a[50][50],sp[50][50],i,j,k=0,m,n; clrscr(); cout cin>>m>>n; cout for(i=0;i { for(j=0;j { cin>>a[i][j]; if(a[i][j]!=0) { k++; sp[k][0]=i; sp[k][1]=j; sp[k][2]=a[i][j]; } } } sp[0][0]=m; sp[0][1]=n; sp[0][2]=k; cout for(i=0;i { for(j=0;j cout cout } getch(); } OUTPUT Enter the order of matrix: 3 3 Enter the elements: ...