COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

Slides:



Advertisements
Similar presentations
BGI graphics library And Visual Studio.
Advertisements

C++ Basics March 10th. A C++ program //if necessary include headers //#include void main() { //variable declaration //read values input from user //computation.
1 Lecture-4 Chapter 2 C++ Syntax and Semantics, and the Program Development Process Dale/Weems/Headington.
1 9/1/06CS150 Introduction to Computer Science 1 What Data Do We Have? CS 150 Introduction to Computer Science I.
CS31: Introduction to Computer Science I Discussion 1A 4/2/2010 Sungwon Yang
 2000 Prentice Hall, Inc. All rights reserved. Chapter 8 - Characters and Strings Outline 8.1Introduction 8.2Fundamentals of Strings and Characters 8.3Character.
Introduction to C language
C - Input & Output When we are saying Input that means to feed some data into program. This can be given in the form of file or from command line. C programming.
Programming is instructing a computer to perform a task for you with the help of a programming language.
CMSC 104, Version 8/061L18Functions1.ppt Functions, Part 1 of 4 Topics Using Predefined Functions Programmer-Defined Functions Using Input Parameters Function.
C++ Basics Structure of a Program. C++ Source Code Plain text file Typical file extension .CPP Must compile the C++ source code without errors before.
CHAPTER 7 DATA INPUT OUTPUT Prepared by: Lec. Ghader R. Kurdi.
1 A simple C++ program // ======================================================= // File:helloworld.cpp // Author:Vana Doufexi // Date:1/4/2006 // Description:Displays.
1 Chapter 2 C++ Syntax and Semantics, and the Program Development Process.
1 Sung-Ju Kang Department of Physics Kangwon National University Basic Concept of The Computer Graphic. For the investigation of the physical problem by.
Khalid Rasheed Shaikh Computer Programming Theory 1.
CSC141 Introduction to Computer Programming Teacher: AHMED MUMTAZ MUSTEHSAN Lecture - 6.
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
2.1 First C Program. First Program Open visual studio, click new file Save as “programName.c” – Program must start with letter and have no spaces – Must.
Silberschatz and Galvin  C Programming Language Kingdom of Saudi Arabia Ministry of Higher Education Al-Majma’ah University College of Education.
C++ CODES PART#04 1 COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT.
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 3: Input/Output Samples.
by sir fakhri alam programing fundamental
INPUT & OUTPUT 10/20/2016Department of Computer Science, UOM | Introduction | Fakhre Alam.
Lecture 3: Getting Started & Input / Output (I/O)
Numbers in ‘C’ Two general categories: Integers Floats
Variables in Java A variable holds either
Programming what is C++
User-Written Functions
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2017
ANNOUNCEMENT The missed lecture will be made up this Monday evening in the Tech PC classroom (MG51). A tentative time interval is 6:30-8:00. The exact.
LESSON 2 Basic of C++.
CSC201: Computer Programming
Chapter 7 Text Input/Output Objectives
Introduction to C++ Systems Programming.
Programming Fundamental
Chapter 2, Part I Introduction to C Programming
Computing Fundamentals
Chapter 7 Text Input/Output Objectives
Introduction to C Language
Algorithms Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
Introduction to C++.
A First Book of ANSI C Fourth Edition
Choice of Programming Language
Visit for more Learning Resources
2008/11/05: Lecture 15 CMSC 104, Section 0101 John Y. Park
Lecture 8b: Strings BJ Furman 15OCT2012.
I/O in C Lecture 6 Winter Quarter Engineering H192 Winter 2005
Introduction to C++ Programming
Programming Funamental slides
More About Data Types & Functions
Functions, Part 1 of 3 Topics Using Predefined Functions
COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Govt. Polytechnic,Dhangar
COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Chapter 3: Input/Output
COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Variables and Expressions
Programming Fundamentals Lecture #3 Overview of Computer Programming
Overloading functions
WEEK-2.
Functions, Part 1 of 3 Topics Using Predefined Functions
C – Programming Language
CPP Programming Language
Functions, Part 1 of 3 Topics Using Predefined Functions
2008/11/05: Lecture 15 CMSC 104, Section 0101 John Y. Park
Introduction to Programming - 1
Course Outcomes of Programming In C (PIC) (17212, C203):
Chapter 2 part #1 C++ Program Structure
Presentation transcript:

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

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

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

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

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

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

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

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

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 RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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