SlideShare a Scribd company logo
C++ Programming Club

     Lecture 1
Steps needed for solving a programming
                    problem
Software engineering steps:
• Problem definition & analysis:
    Identifying inputs/outputs of a problem. Develop a list of
    variables & indicate their relationship.

• Algorithm development:
  Pseudo code or flowchart.

• Coding:
  Converting algorithm into a programming language.

• Testing & Debugging
                              (1)
Programming Algorithms

General form of a computer algorithm:
             INPUT → PROCESSING → OUTPUT
Algorithm types: pseudo code & flowchart.

Pseudo code is the steps of an algorithm written in
concise natural language for problem solving.
Example: Ohms law.
1. Start.
2. Input resistor R & voltage V values.
3. Compute current I = V/R.
4. Output I (Current).
5. Stop.
                            (2)
Commands for the C++ preprocessor.
Preprocessor         Lines beginning with # are preprocessor
  Directive                        directives.




                       C++ contains one or more functions,
    Main             the main function must be one of them.
  Function



 Declaration          Within the main function all variables
                       must be declared to the compiler.
   Block



 Statement                Statement block contains the
    Block                     program statements.

               (3)
A SIMPLE C++ PROGRAM        Remarks for program
                                   clearity. These are not
                                          compiled
//A Welcome Messege
                                     It’s a type of pre-
                                   processor directive .It
#include<iostream>                 enable the compiler to
Using name space std;              recognize i/p and o/p.
Void main ()                     Function that accepts
{                                And returns no value.
                                 {} is used for opening
                                 and closing a function.
cout<<“Welcome to C++!”<<endl;
                                 Output statement that
                                 displays text on screen
System (“pause”);                All statements end
}                                with a ;

                                 Written so that the
                                 command prompt does
                                 not quickly disappear but
                    (4)          remains on the screen.
• C++ Data Types




But we shall be only dealing with Interger , Character and
Floating point!
                            (5)
How To Find Out The Force Exerted On
      An Object By Using C++
// Finding out the force
#include <iostream>
using namespace std;
Void main ()
{
   float f,m,a;                           // variables that will be used
cout<<“Please enter the mass:”;          //Displayed on the screen
cin>>m;                                 // First Input
cout<<“Please enter the area:”        // Displayed on the screen
cin>>a;                              //Second Input
f=m*a;                              //Processing
cout<<f<<endl;                     //Output
system (“pause”);
}

                             (6)
• Home Work
1.Write an assignment statement to calculate
the circumference of a circle. The formula for
determining the circumference, c, of a
circle is c = 2*pi*r, where r is the radius and pi
equals 3.1416.
2. Write an assignment statement to convert
temperature in degrees Fahrenheit
to degrees Celsius. The formula for this
conversion is Celsius = 5/9 (Fahrenheit - 32).
                   (7)

More Related Content

What's hot

Loop c++
Loop c++Loop c++
Loop c++
Mood Mood
 
4th_Ed_Ch03.pdf
4th_Ed_Ch03.pdf4th_Ed_Ch03.pdf
4th_Ed_Ch03.pdf
ShifatiRabbi
 
Practiceproblems(1)
Practiceproblems(1)Practiceproblems(1)
Practiceproblems(1)
Sena Nama
 
Conditional statements in vb script
Conditional statements in vb scriptConditional statements in vb script
Conditional statements in vb script
Nilanjan Saha
 
Lecture 7- Operators and Expressions
Lecture 7- Operators and Expressions Lecture 7- Operators and Expressions
Lecture 7- Operators and Expressions
Md. Imran Hossain Showrov
 
C++ loop
C++ loop C++ loop
C++ loop
Khelan Ameen
 
Lập trình C
Lập trình CLập trình C
Lập trình C
Viet NguyenHoang
 
Decision statements in c language
Decision statements in c languageDecision statements in c language
Decision statements in c language
tanmaymodi4
 
Control Statements, Array, Pointer, Structures
Control Statements, Array, Pointer, StructuresControl Statements, Array, Pointer, Structures
Control Statements, Array, Pointer, Structures
indra Kishor
 
Introduction to Basic C programming 02
Introduction to Basic C programming 02Introduction to Basic C programming 02
Introduction to Basic C programming 02
Wingston
 
Lecture 12 - Recursion
Lecture 12 - Recursion Lecture 12 - Recursion
Lecture 12 - Recursion
Md. Imran Hossain Showrov
 
C++ quik notes
C++ quik notesC++ quik notes
C++ quik notes
argusacademy
 
Loop control in c++
Loop control in c++Loop control in c++
Loop control in c++
Debre Tabor University
 
C++ TUTORIAL 2
C++ TUTORIAL 2C++ TUTORIAL 2
C++ TUTORIAL 2
Farhan Ab Rahman
 
Programming C Part 03
Programming C Part 03Programming C Part 03
Programming C Part 03
Raselmondalmehedi
 

What's hot (20)

Loop c++
Loop c++Loop c++
Loop c++
 
4th_Ed_Ch03.pdf
4th_Ed_Ch03.pdf4th_Ed_Ch03.pdf
4th_Ed_Ch03.pdf
 
Practiceproblems(1)
Practiceproblems(1)Practiceproblems(1)
Practiceproblems(1)
 
Conditional statements in vb script
Conditional statements in vb scriptConditional statements in vb script
Conditional statements in vb script
 
Lecture 7- Operators and Expressions
Lecture 7- Operators and Expressions Lecture 7- Operators and Expressions
Lecture 7- Operators and Expressions
 
C++ loop
C++ loop C++ loop
C++ loop
 
Lập trình C
Lập trình CLập trình C
Lập trình C
 
Decision statements in c language
Decision statements in c languageDecision statements in c language
Decision statements in c language
 
Control Statements, Array, Pointer, Structures
Control Statements, Array, Pointer, StructuresControl Statements, Array, Pointer, Structures
Control Statements, Array, Pointer, Structures
 
Lập trình C
Lập trình CLập trình C
Lập trình C
 
c++
c++c++
c++
 
Introduction to Basic C programming 02
Introduction to Basic C programming 02Introduction to Basic C programming 02
Introduction to Basic C programming 02
 
Lecture 12 - Recursion
Lecture 12 - Recursion Lecture 12 - Recursion
Lecture 12 - Recursion
 
Input And Output
 Input And Output Input And Output
Input And Output
 
Chap 3 c++
Chap 3 c++Chap 3 c++
Chap 3 c++
 
C++ quik notes
C++ quik notesC++ quik notes
C++ quik notes
 
Loop control in c++
Loop control in c++Loop control in c++
Loop control in c++
 
C++ TUTORIAL 2
C++ TUTORIAL 2C++ TUTORIAL 2
C++ TUTORIAL 2
 
Programming C Part 03
Programming C Part 03Programming C Part 03
Programming C Part 03
 
Lab # 2
Lab # 2Lab # 2
Lab # 2
 

Viewers also liked

Programming Fundamental Presentation
Programming Fundamental PresentationProgramming Fundamental Presentation
Programming Fundamental Presentation
fazli khaliq
 
Computer Programming in C++
Computer Programming in C++ Computer Programming in C++
Computer Programming in C++
Dreamtech Press
 
High Level Programming Constructs
High Level Programming ConstructsHigh Level Programming Constructs
High Level Programming Constructs
Forrester High School
 
c++ programming Unit 1 introduction to c++
c++ programming Unit 1  introduction to c++c++ programming Unit 1  introduction to c++
c++ programming Unit 1 introduction to c++
AAKASH KUMAR
 
Chapter3: fundamental programming
Chapter3: fundamental programmingChapter3: fundamental programming
Chapter3: fundamental programming
Ngeam Soly
 
Intro To Programming Concepts
Intro To Programming ConceptsIntro To Programming Concepts
Intro To Programming ConceptsJussi Pohjolainen
 
Programming Fundamentals
Programming FundamentalsProgramming Fundamentals
Programming Fundamentals
Trivuz ত্রিভুজ
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programming
Noel Malle
 
Basic c++ programs
Basic c++ programsBasic c++ programs
Basic c++ programs
harman kaur
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
Soran University
 
Introduction to Pseudocode
Introduction to PseudocodeIntroduction to Pseudocode
Introduction to PseudocodeDamian T. Gordon
 
Lect 1. introduction to programming languages
Lect 1. introduction to programming languagesLect 1. introduction to programming languages
Lect 1. introduction to programming languagesVarun Garg
 
structured programming Introduction to c fundamentals
structured programming Introduction to c fundamentalsstructured programming Introduction to c fundamentals
structured programming Introduction to c fundamentals
OMWOMA JACKSON
 

Viewers also liked (15)

Programming Fundamental Presentation
Programming Fundamental PresentationProgramming Fundamental Presentation
Programming Fundamental Presentation
 
Computer Programming in C++
Computer Programming in C++ Computer Programming in C++
Computer Programming in C++
 
High Level Programming Constructs
High Level Programming ConstructsHigh Level Programming Constructs
High Level Programming Constructs
 
c++ programming Unit 1 introduction to c++
c++ programming Unit 1  introduction to c++c++ programming Unit 1  introduction to c++
c++ programming Unit 1 introduction to c++
 
Chapter3: fundamental programming
Chapter3: fundamental programmingChapter3: fundamental programming
Chapter3: fundamental programming
 
Intro To Programming Concepts
Intro To Programming ConceptsIntro To Programming Concepts
Intro To Programming Concepts
 
C++ language
C++ languageC++ language
C++ language
 
Programming Fundamentals
Programming FundamentalsProgramming Fundamentals
Programming Fundamentals
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programming
 
Intro to C++ - language
Intro to C++ - languageIntro to C++ - language
Intro to C++ - language
 
Basic c++ programs
Basic c++ programsBasic c++ programs
Basic c++ programs
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
Introduction to Pseudocode
Introduction to PseudocodeIntroduction to Pseudocode
Introduction to Pseudocode
 
Lect 1. introduction to programming languages
Lect 1. introduction to programming languagesLect 1. introduction to programming languages
Lect 1. introduction to programming languages
 
structured programming Introduction to c fundamentals
structured programming Introduction to c fundamentalsstructured programming Introduction to c fundamentals
structured programming Introduction to c fundamentals
 

Similar to C++ Programming Club-Lecture 1

Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programmingAlpana Gupta
 
OOPS using C++
OOPS using C++OOPS using C++
OOPS using C++
cpjcollege
 
cmp104 lec 8
cmp104 lec 8cmp104 lec 8
cmp104 lec 8kapil078
 
Prog1-L1.pdf
Prog1-L1.pdfProg1-L1.pdf
Prog1-L1.pdf
valerie5142000
 
Introduction to C++ lecture ************
Introduction to C++ lecture ************Introduction to C++ lecture ************
Introduction to C++ lecture ************
Emad Helal
 
C++ programming language basic to advance level
C++ programming language basic to advance levelC++ programming language basic to advance level
C++ programming language basic to advance level
sajjad ali khan
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
gajendra singh
 
Beginner C++ easy slide and simple definition with questions
Beginner C++ easy slide and simple definition with questions Beginner C++ easy slide and simple definition with questions
Beginner C++ easy slide and simple definition with questions
khawajasharif
 
basic program
basic programbasic program
basic program
NIDA HUSSAIN
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
Sangharsh agarwal
 
Complete C programming Language Course
Complete C programming Language CourseComplete C programming Language Course
Complete C programming Language Course
Vivek chan
 
lecture1 pf.pptx
lecture1 pf.pptxlecture1 pf.pptx
lecture1 pf.pptx
MalikMFalakShairUnkn
 
1 CMPS 12M Introduction to Data Structures Lab La.docx
1 CMPS 12M Introduction to Data Structures Lab La.docx1 CMPS 12M Introduction to Data Structures Lab La.docx
1 CMPS 12M Introduction to Data Structures Lab La.docx
tarifarmarie
 
C++ AND CATEGORIES OF SOFTWARE
C++ AND CATEGORIES OF SOFTWAREC++ AND CATEGORIES OF SOFTWARE
C++ AND CATEGORIES OF SOFTWARE
UNIVERSITY OF ENGINEERING AND TECHNOLOGY TAXILA
 
Programming Fundamentals lecture 5
Programming Fundamentals lecture 5Programming Fundamentals lecture 5
Programming Fundamentals lecture 5
REHAN IJAZ
 
Common Programming Errors
Common Programming ErrorsCommon Programming Errors
Common Programming Errors
Nicole Ynne Estabillo
 
Programming in C
Programming in CProgramming in C
Programming in C
Nishant Munjal
 

Similar to C++ Programming Club-Lecture 1 (20)

Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Fp201 unit2 1
Fp201 unit2 1Fp201 unit2 1
Fp201 unit2 1
 
OOPS using C++
OOPS using C++OOPS using C++
OOPS using C++
 
cmp104 lec 8
cmp104 lec 8cmp104 lec 8
cmp104 lec 8
 
Prog1-L1.pdf
Prog1-L1.pdfProg1-L1.pdf
Prog1-L1.pdf
 
Introduction to C++ lecture ************
Introduction to C++ lecture ************Introduction to C++ lecture ************
Introduction to C++ lecture ************
 
C notes.pdf
C notes.pdfC notes.pdf
C notes.pdf
 
C++ programming language basic to advance level
C++ programming language basic to advance levelC++ programming language basic to advance level
C++ programming language basic to advance level
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Beginner C++ easy slide and simple definition with questions
Beginner C++ easy slide and simple definition with questions Beginner C++ easy slide and simple definition with questions
Beginner C++ easy slide and simple definition with questions
 
basic program
basic programbasic program
basic program
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
 
Complete C programming Language Course
Complete C programming Language CourseComplete C programming Language Course
Complete C programming Language Course
 
lecture1 pf.pptx
lecture1 pf.pptxlecture1 pf.pptx
lecture1 pf.pptx
 
1 CMPS 12M Introduction to Data Structures Lab La.docx
1 CMPS 12M Introduction to Data Structures Lab La.docx1 CMPS 12M Introduction to Data Structures Lab La.docx
1 CMPS 12M Introduction to Data Structures Lab La.docx
 
C++ AND CATEGORIES OF SOFTWARE
C++ AND CATEGORIES OF SOFTWAREC++ AND CATEGORIES OF SOFTWARE
C++ AND CATEGORIES OF SOFTWARE
 
Programming Fundamentals lecture 5
Programming Fundamentals lecture 5Programming Fundamentals lecture 5
Programming Fundamentals lecture 5
 
Common Programming Errors
Common Programming ErrorsCommon Programming Errors
Common Programming Errors
 
C tutorial
C tutorialC tutorial
C tutorial
 
Programming in C
Programming in CProgramming in C
Programming in C
 

More from Ammara Javed

Programmable logic devices
Programmable logic devicesProgrammable logic devices
Programmable logic devicesAmmara Javed
 
The Impact Of Holy Quran In Our Everyday Life
The Impact Of Holy Quran In Our Everyday LifeThe Impact Of Holy Quran In Our Everyday Life
The Impact Of Holy Quran In Our Everyday LifeAmmara Javed
 

More from Ammara Javed (15)

Counters
CountersCounters
Counters
 
Registers
RegistersRegisters
Registers
 
Flip flops
Flip flopsFlip flops
Flip flops
 
Logic Gates
Logic GatesLogic Gates
Logic Gates
 
Programmable logic devices
Programmable logic devicesProgrammable logic devices
Programmable logic devices
 
Maxterms
MaxtermsMaxterms
Maxterms
 
Karnaugh Maps
Karnaugh MapsKarnaugh Maps
Karnaugh Maps
 
Demultiplexers
DemultiplexersDemultiplexers
Demultiplexers
 
Minterms
MintermsMinterms
Minterms
 
Multiplexer
MultiplexerMultiplexer
Multiplexer
 
Boolean algebra
Boolean algebraBoolean algebra
Boolean algebra
 
Encoders
EncodersEncoders
Encoders
 
Decoders
DecodersDecoders
Decoders
 
Circuit Analysis-
Circuit Analysis-Circuit Analysis-
Circuit Analysis-
 
The Impact Of Holy Quran In Our Everyday Life
The Impact Of Holy Quran In Our Everyday LifeThe Impact Of Holy Quran In Our Everyday Life
The Impact Of Holy Quran In Our Everyday Life
 

C++ Programming Club-Lecture 1

  • 2. Steps needed for solving a programming problem Software engineering steps: • Problem definition & analysis: Identifying inputs/outputs of a problem. Develop a list of variables & indicate their relationship. • Algorithm development: Pseudo code or flowchart. • Coding: Converting algorithm into a programming language. • Testing & Debugging (1)
  • 3. Programming Algorithms General form of a computer algorithm: INPUT → PROCESSING → OUTPUT Algorithm types: pseudo code & flowchart. Pseudo code is the steps of an algorithm written in concise natural language for problem solving. Example: Ohms law. 1. Start. 2. Input resistor R & voltage V values. 3. Compute current I = V/R. 4. Output I (Current). 5. Stop. (2)
  • 4. Commands for the C++ preprocessor. Preprocessor Lines beginning with # are preprocessor Directive directives. C++ contains one or more functions, Main the main function must be one of them. Function Declaration Within the main function all variables must be declared to the compiler. Block Statement Statement block contains the Block program statements. (3)
  • 5. A SIMPLE C++ PROGRAM Remarks for program clearity. These are not compiled //A Welcome Messege It’s a type of pre- processor directive .It #include<iostream> enable the compiler to Using name space std; recognize i/p and o/p. Void main () Function that accepts { And returns no value. {} is used for opening and closing a function. cout<<“Welcome to C++!”<<endl; Output statement that displays text on screen System (“pause”); All statements end } with a ; Written so that the command prompt does not quickly disappear but (4) remains on the screen.
  • 6. • C++ Data Types But we shall be only dealing with Interger , Character and Floating point! (5)
  • 7. How To Find Out The Force Exerted On An Object By Using C++ // Finding out the force #include <iostream> using namespace std; Void main () { float f,m,a; // variables that will be used cout<<“Please enter the mass:”; //Displayed on the screen cin>>m; // First Input cout<<“Please enter the area:” // Displayed on the screen cin>>a; //Second Input f=m*a; //Processing cout<<f<<endl; //Output system (“pause”); } (6)
  • 8. • Home Work 1.Write an assignment statement to calculate the circumference of a circle. The formula for determining the circumference, c, of a circle is c = 2*pi*r, where r is the radius and pi equals 3.1416. 2. Write an assignment statement to convert temperature in degrees Fahrenheit to degrees Celsius. The formula for this conversion is Celsius = 5/9 (Fahrenheit - 32). (7)