COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

Slides:



Advertisements
Similar presentations
Complete Structure class Date {class Date { private :private : // private data and functions// private data and functions public :public : // public data.
Advertisements

Review of Inheritance. 2 Several Levels of Inheritance Base Class B Derived class D Derived class D1.
Revision.
C++ Basics March 10th. A C++ program //if necessary include headers //#include void main() { //variable declaration //read values input from user //computation.
Sort the given string, without using string handling functions.
Functions in C++. Functions  Groups a number of program statements into a unit & gives it a name.  Is a complete and independent program.  Divides.
ARRAY BASED STACK DATED: 30 TH AUG 2012 CLASS - XII.
#include int main(){ int base,power,result=1; cout "; cin>>base; cout "; cin>>power; for(int i=0;i
Engineering Problem Solving with C++ An Object Based Approach Chapter 7 Two-Dimensional Arrays and Matrices.
#include using namespace std; void main() { int a[3]={10,11,23}; for(int i=0;i
CS150 Introduction to Computer Science 1
Smoking is prohibited 1 CS 101 Second Exam Review Prepared by Dr. Amer Al-Badarneh 
1 10/9/06CS150 Introduction to Computer Science 1 for Loops.
Multiple-Subscripted Array
Operator Overloading. 2 C++ has the ability to assign special meaning to an operator, called operator overloading one operator can be used to carry out.
Exposure C++ Chapter IV Introduction to C++ Programs.
Chapter 05 (Part V) Control Statements: Part II. Nested For-Structures Consider the following codes: for (int i=0; i
Functions Pass by Reference Alina Solovyova-Vincent Department of Computer Science & Engineering University of Nevada, Reno Fall 2005.
 An instruction or group of instructions.  Computer executes program repeatedly for specified number of times. Or until some terminating conditions are.
Course Title Object Oriented Programming with C++ Course instructor ADEEL ANJUM Chapter No: 05 ARRAY 1 BY ADEEL ANJUM (MSc-cs, CCNA,WEB DEVELOPER) 1.
Chapter: 01 C++ Revision Tour
Computer Science Department LOOPS. Computer Science Department Loops Loops Cause a section of your program to be repeated a certain number of times. The.
Inheritance Examples. Example Of Multiple Inheritance class personnel { protected: char name[30]; char addr[30]; char [30]; char birth_date[30];
Tracing through E01, question 9 – step 1 // p02.cc P. Conrad, for CISC181 07S // Exam question for E01 #include using namespace std; void mysteryFunction(int.
1 Remember: Examination is a chance not ability. By ILTAF MEHDI, IT LECTURER, MIHE, KATR-E-PARWAN BRANCH, KABUL.
String functions+ string I.Mona Alshehri. String Functions: Header file:#include Function: Int strlen(char s[n]) Description Calculates the length of.
Array & Matrix Selected topics. 1. It will compare two adjacent elements, if second element is smaller than the first then it will swap them, if we wanted.
Computer Science Department CPS 235 Object Oriented Programming Paradigm Lecturer Aisha Khalid Khan Inheritance.
11/10/2016CS150 Introduction to Computer Science 1 Last Time  We covered “for” loops.
For Loop Lecture No 8. Definition In computer science a for loop is a programming language statement which allows code to be repeatedly executed. A for.
Programming Fundamentals by Dr. Nadia Y. Yousif1 Control Structures (Selections) Topics to cover here: Selection statements in the algorithmic language:
Review. Problem 1 What is the output of the following piece of code void increment(int x) { x++; } int main() { int y = 10; increment(y); cout
Print Row Function void PrintRow(float x[ ][4],int i) { int j; for(j=0;j
 Memory setup  Pointer declaration  Address operator  Indirection  Printing addresses or pointers.
Lecture #15 ARRAYS By Shahid Naseem (Lecturer). 2 ARRAYS DEFINITION An array is a sequence of objects of same data type. The objects in an array are also.
MR. CRONE Generating Random Numbers. Random Numbers Many programs require the computer to generate random numbers Random numbers are used in many applications.
Intro. to Computer Programming Eng. Nehal A. Mohamed Spring Semester-2016.
Object-Oriented Programming (OOP) Lecture No. 24.
1 Two-Dimensional Arrays. 2 Terminology Two-dimensional arrays represent matrices A matrix contains a number of values of the same data type The values.
for( 起始條件 ; 判斷式 ; 條件運算 ){ // 迴圈內容 } while( 判斷式 ){ // 迴圈內容 } do{ // 迴圈內容 } while( 判斷式 ) ;
Asif Nawaz University Institute of Information Technology, PMAS-AAUR Lecture 05: Object Oriented Programming:2014 Object-Oriented Programming in C++ Exception.
C++ CODES PART#04 1 COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT.
LESSON 5 Loop Control Structure. Loop Control Structure  Operation made over and over again.  Iterate statement.
T/F  The following code will compile without error. int x = 3, y = 4, z = 5; double k = 3.4; cout
2-D Array.
Two Dimensional Array Mr. Jacobs.
Intro to Programming Week # 6 Repetition Structure Lecture # 10
MULTI-DIMENSIONAL ARRAY
COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Ambiguity Resolution in Inheritance
COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
OBJECTIVE QUESTIONS.
COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
1020: Introduction to Programming Mohamed Shehata November 7, 2016
COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Cs212: DataStructures Computer Science Department Lab 3 : Recursion.
COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
CS150 Introduction to Computer Science 1
CS150 Introduction to Computer Science 1
Name: Muhammad Hassan VU-ID: BC Version: Office 2007
ENGR.SABA MUGHAL FROM COMPUTER SYSTEM DEPARTMENT
CPP Programming Language
ENGR.SABA MUGHAL FROM COMPUTER SYSTEM DEPARTMENT
COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
CS150 Introduction to Computer Science 1
Introduction to Algorithms and Programming COMP151
Programming Fundamental
Programming Fundamental-1
Presentation transcript:

COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT C++ CODES PART#05 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT USING FOR LOOP #include<constream.h> void main() {clrscr(); int a,b,c ; for(a=1;a<=10;a++){ cout<<"\n"; COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT CONTINUE…. for(b=1;b<=10;b++){ c=a*b; cout<< c << ""; } 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

Print * 15 times with two loops #include<constream.h> void main() {clrscr(); int a,b; for(a=1;a<=5;a++){ for(b=1;b<=a;b++){ cout<<"*"; cout<<endl;} 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

Print * as shown in the output #include<constream.h> void main() {clrscr(); int a,b,c; for(a=1;a<=5;a++){ for(c=5;c>=a;c--){ cout<<"" ;} COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT CONTINUE…. for(b=1;b<=a;b++){ cout<<"*";} cout<<endl;} 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

Print * as shown in the output #include<constream.h> void main() {clrscr(); int a,b,c; for(a=1;a<=7;a+=2){ for(c=5;c>=a;c-=2){ cout<<"";} COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT CONTINUE… for(b=1;b<=a;b++){ cout<<"*";} cout<<endl;} 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

Print table of any number #include<constream.h> void main() {clrscr(); int a,b,c; cin>>a; for(b=1;b<11;b++){ c=a*b; cout<<endl<<a<<"*"<<b<<"="<<c;} 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

Print * as shown in the output #include<constream.h> void main() {clrscr(); int a,b; for(a=5;a>=1;a--){ for(b=1;b<=a;b++){ cout<<"*";} cout<<endl;} 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

Print * as shown in the output… #include<constream.h> void main() {clrscr(); int a,b,c,d,e ; for(a=1;a<=7;a+=2){ for(c=5;c>=a;c-=2){ cout<<" " ;} for(b=1;b<=a;b++){ COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT CONTINUE…. cout<<"*";} cout<<endl;} for(d=5;d>=1;d-=2){ for(e=5;e>=d;e-=2){ cout<<" ";} for(b=1;b<=d;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

Print 7 as shown in output.. #include<constream.h> void main() {clrscr(); int a,b; for(a=1;a<=5;a++){ for(b=1;b<=a;b++){ cout<<"7";} cout<<endl;} 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

Print only result of tables from 1 to 5 #include <constream.h> void main() { clrscr(); for(int i=1;i<=10;i++) for(int j=1;j<=5;j++) COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT CONTINUE… { cout << i*j << "\t"; } cout << endl; getch(); NOTE:THIS PROGRAM IS PROPERLY INDENTED 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 CONCLUSION NICE WORDINGS…. Without continual growth and progress, such words as improvement, achievement, and success have no meaning. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT