SlideShare ist ein Scribd-Unternehmen logo
1 von 8
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)

Weitere Àhnliche Inhalte

Was ist angesagt?

Input And Output
 Input And Output Input And Output
Input And Output
Ghaffar Khan
 

Was ist angesagt? (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
 

Andere mochten auch

Intro To Programming Concepts
Intro To Programming ConceptsIntro To Programming Concepts
Intro To Programming Concepts
Jussi Pohjolainen
 
Intro to C++ - language
Intro to C++ - languageIntro to C++ - language
Intro to C++ - language
Jussi Pohjolainen
 
Introduction to Pseudocode
Introduction to PseudocodeIntroduction to Pseudocode
Introduction to Pseudocode
Damian T. Gordon
 
Lect 1. introduction to programming languages
Lect 1. introduction to programming languagesLect 1. introduction to programming languages
Lect 1. introduction to programming languages
Varun Garg
 

Andere mochten auch (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
 

Ähnlich wie C++ Programming Club-Lecture 1

Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
Alpana Gupta
 
Fp201 unit2 1
Fp201 unit2 1Fp201 unit2 1
Fp201 unit2 1
rohassanie
 
cmp104 lec 8
cmp104 lec 8cmp104 lec 8
cmp104 lec 8
kapil078
 
C notes.pdf
C notes.pdfC notes.pdf
C notes.pdf
Durga Padma
 
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 tutorial
C tutorialC tutorial
C tutorial
Amit Dhiman
 

Ähnlich wie 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
 

Mehr von Ammara Javed

Programmable logic devices
Programmable logic devicesProgrammable logic devices
Programmable logic devices
Ammara Javed
 
Karnaugh Maps
Karnaugh MapsKarnaugh Maps
Karnaugh Maps
Ammara Javed
 
Demultiplexers
DemultiplexersDemultiplexers
Demultiplexers
Ammara Javed
 
Boolean algebra
Boolean algebraBoolean algebra
Boolean algebra
Ammara Javed
 
Circuit Analysis-
Circuit Analysis-Circuit Analysis-
Circuit Analysis-
Ammara 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 Life
Ammara Javed
 

Mehr von 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)