1 / 42

FreeDownloadPowerPoint.Com

FreeDownloadPowerPoint.Com. SWAPPING FUNCTION. #include<constream.h> void swap(int&a,int&b) {int temp; temp=a; a=b; b=temp; }. Continue…. void main() {int a,b; clrscr(); cin>>a>>b; swap(a,b); cout<<"A="<<a<<endl<<"B="<<b; getch();}. Output……. POINTER WITHOUT FUNCTION.

manchu
Download Presentation

FreeDownloadPowerPoint.Com

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. FreeDownloadPowerPoint.Com COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  2. SWAPPING FUNCTION #include<constream.h> void swap(int&a,int&b) {int temp; temp=a; a=b; b=temp; } COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  3. Continue…. void main() {int a,b; clrscr(); cin>>a>>b; swap(a,b); cout<<"A="<<a<<endl<<"B="<<b; getch();} COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  4. Output…… COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  5. POINTER WITHOUT FUNCTION #include<constream.h> void main() {clrscr(); int x=2,y=5; int*px,*py; px=&x; py=&y; COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  6. Continue…… *px+=10; *py+=20; cout<<*px<<endl<<*py; getch(); } COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  7. Output…… COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  8. FIND FACTORIAL BY POINTER USING “BY REFERENCE” CONCEPT #include<constream.h> void fact(int &y) {int z=1; for(int q=y;q>=1;q--) { z=z*q; y=z; }} COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  9. Continue…. void main() {clrscr(); int x; cin>>x; fact(x); cout<<"the factorial="<<x; getch();} COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  10. Output…… COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  11. stdio.h • stdio.h, which stands for "standard input/output header", is the header in the Cstandard library that contains macro definitions, constants, and declarations of functions and types used for various standard input and output operations. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  12. printf • Printf functions (which stands for "print formatted") are a class offunctions typically associated with some types of programming languages,particularly used for the printing purpose. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  13. WRITE YOUR NAME IN COLORFUL AND BLINKING MANNER #include<constream.h> void main() {clrscr(); textcolor(GREEN+BLINK); textbackground(BLUE); cprintf("ENGR.SABA MUGHAL"); getch();} COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  14. Output….. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  15. BGI stands for “Borland Graphics Interface ”(File Name Extension) • Borland Graphics Interface also known as BGI, is a graphics library bundled with several Borland compilers for the DOS operating systems. BGI was also used to provide graphics for many other Borland products  COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  16. DRAWING A SINGLE LINE USING GRAPHICS #include<constream.h> #include<graphics.h> void main() { clrscr(); int gdriver=DETECT,gmode; initgraph(&gdriver,&gmode,"C:\\tc-300\\bgi"); line(5,5,50,50); getch(); } COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  17. OUTPUT….. SLANTING POSITIONED LINE WILL BE DRAWN • SLANTING MEANS:To give a direction other than perpendicular or horizontal to; make diagonal; cause to slope • IN OUPUT A DIAGONAL LINE WILL BE DRAWN COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  18. MAKE CODE USING dos.h,graphics.h,getmax,setcolor,text style and line statement to display animated lines with your name #include<constream.h> #include<graphics.h> #include<dos.h> void main() { int gdriver=DETECT,gmode,c=4; initgraph(&gdriver,&gmode,"c:\\tc-300\\bgi"); COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  19. Continue…. int x=getmaxx()/2; int y=getmaxy()/2; for(int i=0;i<=500;i+=20) { delay(100); setcolor(c++); line(x,i,x,0); COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  20. Continue…. line(x,y,0,i); line(x,y,x*2,y); } settextjustify(0,1); settextstyle(1,1,3); setcolor(WHITE); outtextxy(x,y,"ENGR.SABA MUGHAL"); getch();} COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  21. Output……. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  22. NESTED ELLIPSES #include<constream.h> #include<graphics.h> #include<dos.h> void main() {clrscr(); int driver=DETECT,mode,i=1; initgraph(&driver,&mode,"c:\\tc-300\\bgi"); COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  23. Continue…. int x=getmaxx()/2; int y=getmaxy()/2; for(int yrad=0;yrad<=100;yrad+=10) {delay(1000); setcolor(i++); ellipse(x,y,360,0,yrad,y); } getch(); } COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  24. Output……….. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  25. DESIGNING A POLYGON #include<conio.h> #include<graphics.h> #define LEFT 50 #define TOP 50 #define RIGHT 150 # define BOT 180 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  26. Continue…. int rightpara[]={150,50,180,20,180,135,150,180}; int topara[]={50,50,150,50,180,20,95,20,50,50}; void main() {clrscr(); COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  27. Continue…. int gdriver=DETECT,gmode; initgraph(&gdriver,&gmode,"c:\\tc-300\\bgi"); setcolor(BLUE); rectangle(LEFT,TOP,RIGHT,BOT); setcolor(RED); drawpoly(4,rightpara); setcolor(GREEN); COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  28. Continue….. drawpoly(5,topara); setcolor(WHITE); outtextxy(95,10,"(95,20)"); outtextxy(20,50,"(20,50)"); outtextxy(180,20,"(180,20)"); outtextxy(50,551,"(50,50)"); outtextxy(150,50,"(150,50)"); COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  29. Continue…. outtextxy(180,135,"(180,135)"); outtextxy(150,180,"(150,180)"); outtextxy(20,182,"(20,180)"); getch();} COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  30. Output……. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  31. FORMATION OF SPIDER’S NET BY USING LINE AND CIRCLE STATEMENTS #include<graphics.h> #include<constream.h> #include<dos.h> void main() {clrscr(); int driver=DETECT,mode,x,y; initgraph(&driver,&mode,"c:\\tc-300\\bgi"); COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  32. Continue…. x=getmaxx(); y=getmaxy(); for(int i=0;i<600;i+=25) {delay(200); setcolor(i); circle(x/2,y/2,i); line(x/2,y/2,x-i,y); COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  33. Continue….. line(x/2,y/2,0,y-1); line(x/2,y/2,0+i,0); line(x/2,y/2,x,0+i); } getch();} COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  34. Output…….. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  35. WHY WINDOWS START FROM C: DRIVE WHY NOT FROM A: DRIVE OR B: DRIVE • We found the answer to your question, along with several tangents on PC drive letters, on the discussion boards at StorageReview.com. This computer forum is exceptionally civil and informative. • The answer goes back to the glory days of floppy discs and DOS. The early DOS COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  36. ANSWER CONTINUE… • operating system designated two drives, A and B, strictly for floppy drives. Why? Because many early computers didn't have native hard drives -- they booted from Drive A, and ran applications from Drive B. • Later, as computers came with hard drives, the second floppy drive became a useless COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  37. ANSWER CONTINUE… • appendage -- the computer equivalent of an appendix. To avoid confusion during the evolutionary window when computers with new hard drives coexisted beside computers with two floppies, the hard drives were given the "C" slot. • Technically speaking, the "computer" isn't missing the B drive, it's just that later Microsoft operating systems have omitted it as unnecessary. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  38. CONCEPT OF STRINGS IN C++ • This page summarizes many of the things you may find it useful to know when working with either C-strings or objects of the C++ string class. • The term string generally means an ordered sequence of characters, with a first character, a second character, and so on, and in most programming languages such COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  39. CONTINUE… strings are enclosed in either single or double quotes. In C++ the enclosing delimiters are double quotes. In this form the string is referred to as a string literal and we often use such string literals in output statements when we wish to display text on the screen for the benefit of our users. For example, the usual first C++ program displays the string literal "Hello, world!" on COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  40. CONTINUE… the screen with the following output statement: cout << "Hello, world!" << endl; However, without string variables about all we can do with strings is output string literals to the screen, so we need to expand our ability to handle string data. When we talk about strings in C++, we must be careful because COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  41. CONTINUE… the C language, with which C++ is meant to be backward compatible, had one way of dealing with strings, while C++ has another, and to further complicate matters there are many non-standard implementations of C++ strings. These should gradually disappear as compiler vendors update their products to implement the string component of the C++ Standard Library. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  42. NICE WORDINGS….. • A wise man first thinks and then speaks and a fool speaks first and then thinks. • Live amongst people in such a manner that if you die they weep over you and if you are alive they crave for your company. • The art of teaching is the art of assisting discovery. • The best teachers teach from the heart, not from the book. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

More Related