Download presentation
Presentation is loading. Please wait.
Published byΤιμόθεος Βιτάλης Modified over 6 years ago
1
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
FreeDownloadPowerPoint.Com COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
2
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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
3
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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
4
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Output…… COPY 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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
6
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Continue…… *px+=10; *py+=20; cout<<*px<<endl<<*py; getch(); } COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
7
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Output…… COPY 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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
9
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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
10
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Output…… COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
11
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 C standard library that contains macro definitions, constants, and declarations of functions and types used for various standard input and output operations. COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
12
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 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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
14
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Output….. COPY 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 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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
17
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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
18
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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
19
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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
20
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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
21
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Output……. COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
22
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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
23
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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
24
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Output……….. COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
25
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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
26
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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
27
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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
28
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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
29
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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
30
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Output……. COPY 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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
32
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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
33
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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
34
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Output…….. COPY 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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
36
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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
37
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 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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
39
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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
40
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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
41
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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
42
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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.