420 likes | 566 Views
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.
E N D
FreeDownloadPowerPoint.Com COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
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
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
Output…… COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
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
Continue…… *px+=10; *py+=20; cout<<*px<<endl<<*py; getch(); } COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Output…… COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
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
Continue…. void main() {clrscr(); int x; cin>>x; fact(x); cout<<"the factorial="<<x; getch();} COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Output…… COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
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
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
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
Output….. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
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
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
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
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
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
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
Output……. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
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
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
Output……….. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
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
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
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
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
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
Output……. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
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
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
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
Output…….. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
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
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
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
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
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
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
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
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