Podcast
Questions and Answers
What is the primary purpose of comments in C++ programs?
What is the primary purpose of comments in C++ programs?
Which of the following steps is NOT typically part of the software development life cycle (SDLC)?
Which of the following steps is NOT typically part of the software development life cycle (SDLC)?
Which symbol indicates the start of a single-line comment in C++?
Which symbol indicates the start of a single-line comment in C++?
What does the #include directive do in a C++ program?
What does the #include directive do in a C++ program?
Signup and view all the answers
Which of the following best describes the C++ programming approach highlighted in the content?
Which of the following best describes the C++ programming approach highlighted in the content?
Signup and view all the answers
Why is the int
keyword included before the main function in C++?
Why is the int
keyword included before the main function in C++?
Signup and view all the answers
What is the purpose of white space characters in C++ source code?
What is the purpose of white space characters in C++ source code?
Signup and view all the answers
Which of the following statements about the main
function is true?
Which of the following statements about the main
function is true?
Signup and view all the answers
What denotes the beginning and the end of a function's body in C++?
What denotes the beginning and the end of a function's body in C++?
Signup and view all the answers
What is the correct statement regarding preprocessing directives in C++?
What is the correct statement regarding preprocessing directives in C++?
Signup and view all the answers
Study Notes
Lecture 3: Programming Fundamentals
- Topic: Software Development Life Cycle (SDLC)
- Definition: Application of standard business practices for building software applications
- Typically divided into 6-8 steps: Planning, Requirements, Design, Coding, Document, Test, Deploy, Maintain
- Project managers may combine, split, or omit steps based on project scope
- More detail available at https://en.wikipedia.org/wiki/Systems_development_life_cycle
Seven Phases of Software Development Life Cycle
- Planning
- Design & Prototyping
- Define Requirements
- Software Development
- Testing
- Deployment
- Operations & Maintenance
SDLC
- 4 Implementation
- 5 Testing & Integration
- 3 Design
- 6 Maintenance
- 2 Analysis
- 1 Planning
Efforts and Cost of Software Development
- Analysis: 20%
- Design: 40%
- Implementation: 15%
- Test: 25%
Costs of Software Development Stages
- Design: 5%
- Requirements: 3%
- Coding: 7%
- Specification: 3%
- Unit test: 8%
- System test: 7%
- Maintenance: 67%
Introduction to C++
- Topic: Programming, Input/Output, and Operators
- Chapter 2 of C++ How to Program, 10/e
2.1 Introduction
- C++ facilitates a disciplined approach to program development
- Most C++ programs process data and display results
2.2 First Program in C++: Printing a Line of Text
- Simple program that prints "Welcome to C++!"
-
#include
### 2.2 First Program in C++: Printing a Line of Text (cont.)
- Comments:
- Document programs
- Help others understand programs
- Ignored by the C++ compiler
- Single-line comment: Starts with `//`
- Multi-line comment: Encloses text in `/*` and `*/`
### Good Programming Practice 2.1
- Every program should start with a comment describing its purpose.
### 2.2 First Program in C++: Printing a Line of Text (cont.)
- Preprocessing directive: A message to the C++ preprocessor
- `#include <iostream>`: Includes the input/output stream header `<iostream>`. This header contains information for input/output operations.
### Common Programming Error 2.1
- Forgetting to include `<iostream>` causes error messages.
### 2.2 First Program in C++: Printing a Line of Text (cont.)
- White space: Blank lines, space characters, and tabs make programs more readable. C++ compilers generally ignore white space
### 2.2 First Program in C++: Printing a Line of Text (cont.)
- `main` is a function in every C++ program where execution begins
- `int main()`: Indicates that `main` returns an integer value which is typically required to be 0 to show the successful program termination.
- Keyword: A reserved word in code that C++ uses
- `{` (left brace): Starts the function body
- `}` (right brace): Ends the function body
### 2.2 First Program in C++: Printing a Line of Text (cont.)
- Statement: An instruction to perform an action.
- String literal: Used in output statements. `"Welcome to C++!"`
- Semicolon `(;):` Marks the end of most statements
- Preprocessing directives do not end with a semicolon
- Good Programming Practice 2.2: Indent the function bodies to enhance readability
- Good Programming Practice 2.3: Establish a convention for indentation use
### 2.2 First Program in C++: Printing a Line of Text (cont.)
- `std::cout`: Standard output stream object that sends characters to the screen
- `std::`: required when using names from `<iostream>`. This means the use of `std` namespace
- Stream insertion operator: `<<`
- Escape character: `\`
- `\n`: Newline character
### 2.2 First Program in C++: Printing a Line of Text (cont.)
- Escape sequences: backslash and the character that follows such as `\n`, `\t`, `\r`, `\\`,`\'`, `\"` which have specific meanings
### 2.2 First Program in C++: Printing a Line of Text (cont.)
- Return statement: Using `return 0`, indicates that the program terminated successfully.
- The `return 0` statement is typically required at the end of the `main` function to indicate the program ended successfully according to the standard.
### 1.1 Introduction
- C++ is a powerful programming language suitable for beginners and experienced programmers
- You write instructions that tell computers what to do. Software controls hardware (computers)
- You'll learn object-oriented programming (OOP) which is the preferred programming method in the present day software development
- You'll create software objects within your programs
### 1.1 Introduction (Cont.)
- C++ is one of today's most popular languages
- C++20 is a standardized version created through ISO and IEC
### 1.5 Machine Languages, Assembly Languages and High-Level Languages
- Programmers use various languages with some directly understandable by computers
- Languages are categorized into: Machine languages, Assembly languages, and High-level languages
### 1.5 Machine Languages, Assembly Languages and High-Level Languages
- Machine languages are represented by numbers (ultimately 1s and 0s). This is difficult for humans to understand.
- Assembly languages utilize abbreviations for instructions to represent operations.
- Assemblers translate assembly instructions into machine language
### 1.5 Machine Languages, Assembly Languages and High-Level Languages
- High-level languages consist of statements similar to English. Compilers translate them into machine language for improved programmer efficiency and code readability
### 1.5 Machine Languages, Assembly Languages and High-Level Languages
- Compilers translate high-level instructions into machine code (takes considerable processing time)
- Interpreters execute high-level code directly, although it's slower than compiled code.
### 1.6 C and C++
- C was developed by Dennis Ritchie in 1972
- C initially became prominent as the language for the UNIX operating system
- C++ evolved from C and is available for most machines. It is also hardware independent
### 1.6 C++ (Cont.)
- C11 is the latest ANSI standard for C++
- C++ was created to make C more consistent for the future.
- C++ employs features that improve C.
- C++ supports object-oriented programming (OOP) which is common now in software development
### 1.6 C++ (Cont.)
- C++ programs consist of classes and functions.
- Standard C++ libraries contain rich collections of classes and functions.
- Learning involves the C++ language itself along with the classes and functions
### 1.7 Programming Languages
- Discussion of various popular programming languages
### 1.9 Typical C++ Development Environment
- C++ systems consist of three parts: Development environment, language, and Standard Library.
- C++ programs follow phases: edit, preprocess, compile, link, load, execute
### 1.9 Typical C++ Development Environment (Cont.)
- Phase 1 (Editing): Creating the program in an editor
### 1.9 Typical C++ Development Environment (Cont.)
- Popular IDEs (integrated development environments): Microsoft Visual Studio, NetBeans, Eclipse, Apple Xcode, CodeLite, CLion
### 1.9 Typical C++ Development Environment (Cont.)
- Phase 2 (Preprocessing): Preprocessor program automatically executes before the compiler's translation phase. Applies any directives before the phase of compilation.
- Preprocessing directives often include copying other files or performing text replacements.
### 1.9 Typical C++ Development Environment (Cont.)
- Phase 3 (Compilation): The compiler translates the C++ program into machine code. Commonly known as object code
### 1.9 Typical C++ Development Environment (Cont.)
- Phase 4 (Linking): The linker combines object code with code for missing parts and creates an executable file
### 1.9 Typical C++ Development Environment (Cont.)
- Phase 5 (Loading): The loader places the executable code into memory prepares it for execution. This involves copying executable files into memory, loading required elements, libraries and resources.
### 1.9 Typical C++ Development Environment (Cont.)
- Phase 6 (Execution): The CPU executes program instructions step by step.
- Some modern CPU architectures execute many instructions in parallel.
### 1.9 Typical C++ Development Environment (Cont.)
- Errors: Programs might not work right away
- Correcting Errors: If the program faces issues during its phases, you will have to return to the edit phase, make corrections, and then process the phases again to ensure you will get the correct result
### 1.9 Typical C++ Development Environment (Cont.)
- Input/Output Operations: Data is typically taken from cin (input), displayed on cout (output), and may optionally be directed to files, printers, or other devices.
- Error Messages: cerr shows error messages when there's an interruption.
### Common Programming Error 1.1
- Runtime errors occur during program execution (e.g., division by zero)
- Fatal runtime errors end the program immediately
- Non-fatal runtime errors allow the program to continue but may give incorrect results
### 1.10 Test-Driving a C++ Application
- Use the Guess-the-Number game as your first C++ application.
### 1.10.2 Compiling and Running Using GNU C++ on Linux
- Step 1: Use the `cd` command to navigate to the application directory
- Step 2: Use the `g++` command with the `-std=c++14` option to compile the program and create an executable file.
- Step 3: Run the executable program using `./executable_filename` at the command line.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
This quiz explores the Software Development Life Cycle (SDLC) and its various phases. Understand the standard practices involved in building software applications, including planning, design, coding, testing, deployment, and maintenance. Suitable for students and professionals looking to solidify their knowledge of software development processes.