The document discusses various input and output functions in C++. It explains that iostream is the header file used for input/output streams and defines cin and cout variables. The extraction operator (>>) is used to read input into variables, but skips whitespace. The getline function reads the entire line of input. The get function reads the next character, including whitespace. The ignore function discards portions of input. The putback and peek functions manipulate the input stream. Predefined functions must be used properly by including the correct header file and following the defined syntax.
This document provides an overview of input and output operations, preprocessor directives, and debugging syntax errors in C++. It discusses including the iostream and string libraries for input/output and string processing. It covers input and output statements using cin and cout, constants, and increment/decrement operators. The document also reviews preprocessor directives like #include and #define, and manipulators for formatting output. It concludes with debugging syntax errors and understanding semantics.
This document provides an introduction to the C++ programming language. It discusses that C++ was developed in 1979 as an extension of C and is an object-oriented language. It then defines various C++ concepts such as tokens, data types, variables, constants, functions, arrays, structures, and input/output streams. It provides examples of how to declare and use these different programming elements in C++ code. The document serves as a high-level overview of fundamental C++ concepts for someone new to the language.
This document discusses input and output in C++. It begins by introducing input, analysis, and output as the three basic stages of most C++ programs. It then discusses input/output from default devices like the keyboard and screen, as well as from files. The key concept for input/output in C++ is streams, which are interfaces that transfer sequences of characters from a source to a destination. There are input streams that convey data into a program and output streams that convey data from a program. The document provides examples of using input and output streams in C++ programs.
Object oriented programming 13 input stream and devices in cppVaibhav Khanna
In C++ input and output is performed in the form of a sequence of bytes or more commonly known as streams. Input Stream: If the direction of flow of bytes is from the device(for example, Keyboard) to the main memory then this process is called input.
This document provides an overview of a C++ programming course. It introduces fundamental C++ concepts like data types, variables, input/output statements, and arithmetic, relational, and logical operators. It also presents some simple example programs to calculate the mean of input numbers to demonstrate basic programming constructs like comments, functions, and conditional statements.
This document provides an overview of input and output in C++. It discusses I/O streams and devices, predefined input and output functions, formatting output, and file I/O. Some key topics covered include the extraction operator >> for input, formatting output using manipulators, reading and writing files using file streams, and opening, reading from, and closing files in C++ programs.
This document provides an overview of input and output in C++. It discusses I/O streams and devices for inputting and outputting data. Predefined functions for input like cin and getline are described. Issues with input failure and how to clear errors are covered. The document also reviews formatting output using manipulators to specify precision, justification, and column alignment. Finally, it provides an example of combining left-justified text and right-justified numbers using the setw manipulator.
This document provides an overview of input and output operations, preprocessor directives, and debugging syntax errors in C++. It discusses including the iostream and string libraries for input/output and string processing. It covers input and output statements using cin and cout, constants, and increment/decrement operators. The document also reviews preprocessor directives like #include and #define, and manipulators for formatting output. It concludes with debugging syntax errors and understanding semantics.
This document provides an introduction to the C++ programming language. It discusses that C++ was developed in 1979 as an extension of C and is an object-oriented language. It then defines various C++ concepts such as tokens, data types, variables, constants, functions, arrays, structures, and input/output streams. It provides examples of how to declare and use these different programming elements in C++ code. The document serves as a high-level overview of fundamental C++ concepts for someone new to the language.
This document discusses input and output in C++. It begins by introducing input, analysis, and output as the three basic stages of most C++ programs. It then discusses input/output from default devices like the keyboard and screen, as well as from files. The key concept for input/output in C++ is streams, which are interfaces that transfer sequences of characters from a source to a destination. There are input streams that convey data into a program and output streams that convey data from a program. The document provides examples of using input and output streams in C++ programs.
Object oriented programming 13 input stream and devices in cppVaibhav Khanna
In C++ input and output is performed in the form of a sequence of bytes or more commonly known as streams. Input Stream: If the direction of flow of bytes is from the device(for example, Keyboard) to the main memory then this process is called input.
This document provides an overview of a C++ programming course. It introduces fundamental C++ concepts like data types, variables, input/output statements, and arithmetic, relational, and logical operators. It also presents some simple example programs to calculate the mean of input numbers to demonstrate basic programming constructs like comments, functions, and conditional statements.
This document provides an overview of input and output in C++. It discusses I/O streams and devices, predefined input and output functions, formatting output, and file I/O. Some key topics covered include the extraction operator >> for input, formatting output using manipulators, reading and writing files using file streams, and opening, reading from, and closing files in C++ programs.
This document provides an overview of input and output in C++. It discusses I/O streams and devices for inputting and outputting data. Predefined functions for input like cin and getline are described. Issues with input failure and how to clear errors are covered. The document also reviews formatting output using manipulators to specify precision, justification, and column alignment. Finally, it provides an example of combining left-justified text and right-justified numbers using the setw manipulator.
This document provides an overview of input and output in C++. It discusses I/O streams and devices for inputting data into a program and outputting data from a program. Predefined input and output functions like cin, cout, getline(), and ignore() are described. The document covers formatting output using manipulators to specify precision, justification, and field widths. It also addresses input failure and how to clear error states using clear(). The key topics are I/O streams, extraction operators, reading data, predefined I/O functions, formatting output, and file I/O.
C++ programming language basic to advance levelsajjad ali khan
C/C++ is a procedural programming language developed in the 1970s. C++ builds on C and adds object-oriented programming capabilities. Some key differences between C and C++ include C++ supporting classes, function overloading, and operator overloading. C++ is commonly used to create operating systems, compilers, databases, games, and other application software. The document then discusses C++ history, creators, uses, data types, variables, operators, control flow statements like if/else and loops, arrays, and multi-dimensional arrays. It provides examples of C++ code and basics of the C++ programming language.
The document provides information on the C programming language. It discusses that C was developed by Dennis Ritchie at Bell Labs in 1972 and is a general purpose programming language well suited for business and scientific applications. It describes the basic structure of a C program including sections for links, definitions, variables, functions, and input/output statements. It also covers various C language concepts like data types, operators, decision making statements, looping statements, functions, and more.
CS 23001 Computer Science II Data Structures & AbstractionPro.docxfaithxdunce63732
CS 23001 Computer Science II: Data Structures & Abstraction
Project #4
Spring 2015
Objectives:
· Develop and use a Tree ADT (n-ary)
· Apply and use tree traversal algorithms
· Manipulate trees by inserting and deleting nodes
· Apply and use STL
Problem:
Build a program profiler. Construct a program to instrument C++ source code to support program profiling.
It is often important to determine how many times a function or statement is executed. This is useful not only for debugging but for determining what parts of a program may need to be optimized. This process is called profiling. That is, a execution profile presents how many times each part of a program is executed using a given set of input data (or for some run time scenario). To compute a profile, statements need to be added to the code that keep track of how many times a function or statement is executed. The process of adding these statements is called instrumenting the code.
To implement a profiler one must first parse the source code and generate an Abstract Syntax Tree (AST) of the code. Each node of the AST describes the syntactic category of the code stored within it (function, statement, while-statement, etc.). So at the top level is a syntactic category corresponding to a program, class, or function (such as in the case of a main). Under that are sub-trees that further detail the syntactic categories of each part of the code. Such things as declarations, parameter lists, while-statement, and expression statements will describe the various parts of the program.
After the AST is generated it can then be traversed and the appropriate syntactic structures can be found that need to be instrumented. Once a construct is found, say a function, new code can be inserted that keeps track of how many times that function is executed.
The most difficult part of constructing a profiler is correctly parsing the source code. Unfortunately, C++ is notoriously difficult to parse. So here we will use a parsing tool called src2srcml. This tool reads in C++ code and marks up the code with XML tags (e.g., block, if, while, condition, name, etc). That is, the output is an AST in XML. The XML representation is called srcML (source code markup language).
A number of srcML data files are provided for the project. However, you can use your own program as input. To run srcML on wasp or hornet you will first need to set a PATH variable so the command can be found. You need to execute the command:
export PATH=/local/opt/srcml/bin:$PATH
It is best if you insert this line into your .bash_profile file in your home directory on wasp/hornet.
Then to generate the srcML file for your own code use the following:
src2srcml main.cpp -o main.cpp.xml
Use the following for a list of all options:
src2srcml --help
More information about srcML can be found at www.srcML.org including a list of all the tag names (see Getting Started). You can also download srcML if you want it on your own machine.
Your .
1. The document discusses object oriented programming concepts like classes, objects, inheritance, and polymorphism in C++.
2. It begins with an introduction to procedural programming and its limitations. Object oriented programming aims to overcome these limitations by emphasizing data over procedures and allowing for inheritance, polymorphism, and encapsulation.
3. The document then covers key OOP concepts like classes, objects, constructors, and static class members in C++. It provides examples of creating classes and objects.
This document provides an overview of C++ programming fundamentals. It discusses two main categories of software: system software and application software. It then introduces the C language, covering its history, evolution, and justification. The document also examines the development environment for C, including tools like editors, compilers, debuggers, and integrated development environments. It provides examples of basic C++ programs and explains the parts and structure of a C++ program.
Object oriented programming system with C++msharshitha03s
This document provides an overview of C++ control statements, functions, and storage classes. It discusses various loops like while, for, and do-while loops. It also covers decision making statements such as if-else, if-else-if-else, switch statements, and unconditional statements like break, continue, and goto. The document then discusses functions, recursion, and inline functions. Finally, it summarizes different storage classes in C++ like auto, register, static, external, and mutable and provides examples of each.
This document summarizes key concepts from an introduction to C++ programming chapter, including:
- The main parts of a C++ program are comments, preprocessor directives, the main() function, and statements.
- Variables are used to store and manipulate data in a program. Variables are declared with a name and type before use.
- Arithmetic operators allow performing calculations in C++ programs. Expressions follow order of operations rules.
- Input and output streams allow getting user input and displaying output to the screen.
The document discusses various C programming concepts like algorithms, flowcharts, tokens, data types, operators, functions, and hardware components of a computer. It includes questions and answers on these topics. Key points covered are definition of algorithm and flowchart, different types of tokens in C, differences between while and do-while loops, definition of software and its types, and examples of standard header files.
This document provides an introduction to C++ programming, covering key concepts like characters, tokens, keywords, identifiers, literals, operators, input/output, variables, comments, and common errors. It explains that C++ was created by Bjarne Stroustrup in the 1980s as an extension of C with object-oriented features from Simula 67.
This document provides an introduction to C++ programming, covering key concepts like characters, tokens, keywords, identifiers, literals, operators, I/O streams, variables, comments, and common errors. It explains that Bjarne Stroustrup extended C to create C++, adding object-oriented features from Simula. The main components discussed are the building blocks of any C++ program - characters, tokens, data types, and basic input/output operations.
C++ Unit 1PPT which contains the Introduction and basic o C++ with OOOps conc...ANUSUYA S
C++ is an object-oriented programming language that began as an expanded version of C. It was invented by Bjarne Stroustrup in 1979 at Bell Labs. C++ supports concepts of object-oriented programming like classes, inheritance, polymorphism, abstraction and encapsulation. It is a compiled, general purpose language that allows both procedural and object-oriented programming. Key features of C++ include input/output streams, declarations, control structures like if-else and switch statements.
02a fundamental c++ types, arithmetic Manzoor ALam
The document discusses fundamental C++ types including integers, characters, and floating-point numbers. It describes integer types like int, short, and long and their typical sizes. Character types represent single characters with examples of escape codes. Floating-point types can represent real numbers in formats like float and double. The document also covers C++ concepts such as variable definitions and declarations, arithmetic operators, assignment, and increment/decrement operators.
Stream is a sequence of bytes that serves as an input or output source. The input stream provides data to a program while the output stream receives output. The get() and put() functions handle single character I/O. The >> operator is overloaded in istream while << is overloaded in ostream. The ios class contains functions like width(), precision(), and fill() for formatting output. Iomanip provides manipulators to format output in a chained manner.
This chapter discusses assignment operators, mathematical library functions, interactive input, symbolic constants, common errors, and debugging in C++. It covers using functions like sqrt() and includes like <cmath>, taking user input with cin, declaring symbolic constants with const, common errors like missing variables, and debugging methods like tracing and echo printing.
This chapter discusses assignment operators, mathematical library functions, interactive input, symbolic constants, common errors, and debugging in C++. It covers using functions like sqrt() and includes like <cmath>, taking user input with cin, declaring symbolic constants with const, common errors like missing variables, and debugging methods like tracing and echo printing.
The document discusses input/output (I/O) streams in C++. It explains that I/O is handled by the iostream library using stream-based classes like istream and ostream. The extraction (>>) and insertion (<<) operators allow input from and output to these streams. Overloading these operators allows user-defined types to be read from and written to streams. This is done by declaring friend operator functions that take a stream and class reference.
Chapter wise All Notes of First year Basic Civil Engineering.pptxDenish Jangid
Chapter wise All Notes of First year Basic Civil Engineering
Syllabus
Chapter-1
Introduction to objective, scope and outcome the subject
Chapter 2
Introduction: Scope and Specialization of Civil Engineering, Role of civil Engineer in Society, Impact of infrastructural development on economy of country.
Chapter 3
Surveying: Object Principles & Types of Surveying; Site Plans, Plans & Maps; Scales & Unit of different Measurements.
Linear Measurements: Instruments used. Linear Measurement by Tape, Ranging out Survey Lines and overcoming Obstructions; Measurements on sloping ground; Tape corrections, conventional symbols. Angular Measurements: Instruments used; Introduction to Compass Surveying, Bearings and Longitude & Latitude of a Line, Introduction to total station.
Levelling: Instrument used Object of levelling, Methods of levelling in brief, and Contour maps.
Chapter 4
Buildings: Selection of site for Buildings, Layout of Building Plan, Types of buildings, Plinth area, carpet area, floor space index, Introduction to building byelaws, concept of sun light & ventilation. Components of Buildings & their functions, Basic concept of R.C.C., Introduction to types of foundation
Chapter 5
Transportation: Introduction to Transportation Engineering; Traffic and Road Safety: Types and Characteristics of Various Modes of Transportation; Various Road Traffic Signs, Causes of Accidents and Road Safety Measures.
Chapter 6
Environmental Engineering: Environmental Pollution, Environmental Acts and Regulations, Functional Concepts of Ecology, Basics of Species, Biodiversity, Ecosystem, Hydrological Cycle; Chemical Cycles: Carbon, Nitrogen & Phosphorus; Energy Flow in Ecosystems.
Water Pollution: Water Quality standards, Introduction to Treatment & Disposal of Waste Water. Reuse and Saving of Water, Rain Water Harvesting. Solid Waste Management: Classification of Solid Waste, Collection, Transportation and Disposal of Solid. Recycling of Solid Waste: Energy Recovery, Sanitary Landfill, On-Site Sanitation. Air & Noise Pollution: Primary and Secondary air pollutants, Harmful effects of Air Pollution, Control of Air Pollution. . Noise Pollution Harmful Effects of noise pollution, control of noise pollution, Global warming & Climate Change, Ozone depletion, Greenhouse effect
Text Books:
1. Palancharmy, Basic Civil Engineering, McGraw Hill publishers.
2. Satheesh Gopi, Basic Civil Engineering, Pearson Publishers.
3. Ketki Rangwala Dalal, Essentials of Civil Engineering, Charotar Publishing House.
4. BCP, Surveying volume 1
This document provides an overview of input and output in C++. It discusses I/O streams and devices for inputting data into a program and outputting data from a program. Predefined input and output functions like cin, cout, getline(), and ignore() are described. The document covers formatting output using manipulators to specify precision, justification, and field widths. It also addresses input failure and how to clear error states using clear(). The key topics are I/O streams, extraction operators, reading data, predefined I/O functions, formatting output, and file I/O.
C++ programming language basic to advance levelsajjad ali khan
C/C++ is a procedural programming language developed in the 1970s. C++ builds on C and adds object-oriented programming capabilities. Some key differences between C and C++ include C++ supporting classes, function overloading, and operator overloading. C++ is commonly used to create operating systems, compilers, databases, games, and other application software. The document then discusses C++ history, creators, uses, data types, variables, operators, control flow statements like if/else and loops, arrays, and multi-dimensional arrays. It provides examples of C++ code and basics of the C++ programming language.
The document provides information on the C programming language. It discusses that C was developed by Dennis Ritchie at Bell Labs in 1972 and is a general purpose programming language well suited for business and scientific applications. It describes the basic structure of a C program including sections for links, definitions, variables, functions, and input/output statements. It also covers various C language concepts like data types, operators, decision making statements, looping statements, functions, and more.
CS 23001 Computer Science II Data Structures & AbstractionPro.docxfaithxdunce63732
CS 23001 Computer Science II: Data Structures & Abstraction
Project #4
Spring 2015
Objectives:
· Develop and use a Tree ADT (n-ary)
· Apply and use tree traversal algorithms
· Manipulate trees by inserting and deleting nodes
· Apply and use STL
Problem:
Build a program profiler. Construct a program to instrument C++ source code to support program profiling.
It is often important to determine how many times a function or statement is executed. This is useful not only for debugging but for determining what parts of a program may need to be optimized. This process is called profiling. That is, a execution profile presents how many times each part of a program is executed using a given set of input data (or for some run time scenario). To compute a profile, statements need to be added to the code that keep track of how many times a function or statement is executed. The process of adding these statements is called instrumenting the code.
To implement a profiler one must first parse the source code and generate an Abstract Syntax Tree (AST) of the code. Each node of the AST describes the syntactic category of the code stored within it (function, statement, while-statement, etc.). So at the top level is a syntactic category corresponding to a program, class, or function (such as in the case of a main). Under that are sub-trees that further detail the syntactic categories of each part of the code. Such things as declarations, parameter lists, while-statement, and expression statements will describe the various parts of the program.
After the AST is generated it can then be traversed and the appropriate syntactic structures can be found that need to be instrumented. Once a construct is found, say a function, new code can be inserted that keeps track of how many times that function is executed.
The most difficult part of constructing a profiler is correctly parsing the source code. Unfortunately, C++ is notoriously difficult to parse. So here we will use a parsing tool called src2srcml. This tool reads in C++ code and marks up the code with XML tags (e.g., block, if, while, condition, name, etc). That is, the output is an AST in XML. The XML representation is called srcML (source code markup language).
A number of srcML data files are provided for the project. However, you can use your own program as input. To run srcML on wasp or hornet you will first need to set a PATH variable so the command can be found. You need to execute the command:
export PATH=/local/opt/srcml/bin:$PATH
It is best if you insert this line into your .bash_profile file in your home directory on wasp/hornet.
Then to generate the srcML file for your own code use the following:
src2srcml main.cpp -o main.cpp.xml
Use the following for a list of all options:
src2srcml --help
More information about srcML can be found at www.srcML.org including a list of all the tag names (see Getting Started). You can also download srcML if you want it on your own machine.
Your .
1. The document discusses object oriented programming concepts like classes, objects, inheritance, and polymorphism in C++.
2. It begins with an introduction to procedural programming and its limitations. Object oriented programming aims to overcome these limitations by emphasizing data over procedures and allowing for inheritance, polymorphism, and encapsulation.
3. The document then covers key OOP concepts like classes, objects, constructors, and static class members in C++. It provides examples of creating classes and objects.
This document provides an overview of C++ programming fundamentals. It discusses two main categories of software: system software and application software. It then introduces the C language, covering its history, evolution, and justification. The document also examines the development environment for C, including tools like editors, compilers, debuggers, and integrated development environments. It provides examples of basic C++ programs and explains the parts and structure of a C++ program.
Object oriented programming system with C++msharshitha03s
This document provides an overview of C++ control statements, functions, and storage classes. It discusses various loops like while, for, and do-while loops. It also covers decision making statements such as if-else, if-else-if-else, switch statements, and unconditional statements like break, continue, and goto. The document then discusses functions, recursion, and inline functions. Finally, it summarizes different storage classes in C++ like auto, register, static, external, and mutable and provides examples of each.
This document summarizes key concepts from an introduction to C++ programming chapter, including:
- The main parts of a C++ program are comments, preprocessor directives, the main() function, and statements.
- Variables are used to store and manipulate data in a program. Variables are declared with a name and type before use.
- Arithmetic operators allow performing calculations in C++ programs. Expressions follow order of operations rules.
- Input and output streams allow getting user input and displaying output to the screen.
The document discusses various C programming concepts like algorithms, flowcharts, tokens, data types, operators, functions, and hardware components of a computer. It includes questions and answers on these topics. Key points covered are definition of algorithm and flowchart, different types of tokens in C, differences between while and do-while loops, definition of software and its types, and examples of standard header files.
This document provides an introduction to C++ programming, covering key concepts like characters, tokens, keywords, identifiers, literals, operators, input/output, variables, comments, and common errors. It explains that C++ was created by Bjarne Stroustrup in the 1980s as an extension of C with object-oriented features from Simula 67.
This document provides an introduction to C++ programming, covering key concepts like characters, tokens, keywords, identifiers, literals, operators, I/O streams, variables, comments, and common errors. It explains that Bjarne Stroustrup extended C to create C++, adding object-oriented features from Simula. The main components discussed are the building blocks of any C++ program - characters, tokens, data types, and basic input/output operations.
C++ Unit 1PPT which contains the Introduction and basic o C++ with OOOps conc...ANUSUYA S
C++ is an object-oriented programming language that began as an expanded version of C. It was invented by Bjarne Stroustrup in 1979 at Bell Labs. C++ supports concepts of object-oriented programming like classes, inheritance, polymorphism, abstraction and encapsulation. It is a compiled, general purpose language that allows both procedural and object-oriented programming. Key features of C++ include input/output streams, declarations, control structures like if-else and switch statements.
02a fundamental c++ types, arithmetic Manzoor ALam
The document discusses fundamental C++ types including integers, characters, and floating-point numbers. It describes integer types like int, short, and long and their typical sizes. Character types represent single characters with examples of escape codes. Floating-point types can represent real numbers in formats like float and double. The document also covers C++ concepts such as variable definitions and declarations, arithmetic operators, assignment, and increment/decrement operators.
Stream is a sequence of bytes that serves as an input or output source. The input stream provides data to a program while the output stream receives output. The get() and put() functions handle single character I/O. The >> operator is overloaded in istream while << is overloaded in ostream. The ios class contains functions like width(), precision(), and fill() for formatting output. Iomanip provides manipulators to format output in a chained manner.
This chapter discusses assignment operators, mathematical library functions, interactive input, symbolic constants, common errors, and debugging in C++. It covers using functions like sqrt() and includes like <cmath>, taking user input with cin, declaring symbolic constants with const, common errors like missing variables, and debugging methods like tracing and echo printing.
This chapter discusses assignment operators, mathematical library functions, interactive input, symbolic constants, common errors, and debugging in C++. It covers using functions like sqrt() and includes like <cmath>, taking user input with cin, declaring symbolic constants with const, common errors like missing variables, and debugging methods like tracing and echo printing.
The document discusses input/output (I/O) streams in C++. It explains that I/O is handled by the iostream library using stream-based classes like istream and ostream. The extraction (>>) and insertion (<<) operators allow input from and output to these streams. Overloading these operators allows user-defined types to be read from and written to streams. This is done by declaring friend operator functions that take a stream and class reference.
Chapter wise All Notes of First year Basic Civil Engineering.pptxDenish Jangid
Chapter wise All Notes of First year Basic Civil Engineering
Syllabus
Chapter-1
Introduction to objective, scope and outcome the subject
Chapter 2
Introduction: Scope and Specialization of Civil Engineering, Role of civil Engineer in Society, Impact of infrastructural development on economy of country.
Chapter 3
Surveying: Object Principles & Types of Surveying; Site Plans, Plans & Maps; Scales & Unit of different Measurements.
Linear Measurements: Instruments used. Linear Measurement by Tape, Ranging out Survey Lines and overcoming Obstructions; Measurements on sloping ground; Tape corrections, conventional symbols. Angular Measurements: Instruments used; Introduction to Compass Surveying, Bearings and Longitude & Latitude of a Line, Introduction to total station.
Levelling: Instrument used Object of levelling, Methods of levelling in brief, and Contour maps.
Chapter 4
Buildings: Selection of site for Buildings, Layout of Building Plan, Types of buildings, Plinth area, carpet area, floor space index, Introduction to building byelaws, concept of sun light & ventilation. Components of Buildings & their functions, Basic concept of R.C.C., Introduction to types of foundation
Chapter 5
Transportation: Introduction to Transportation Engineering; Traffic and Road Safety: Types and Characteristics of Various Modes of Transportation; Various Road Traffic Signs, Causes of Accidents and Road Safety Measures.
Chapter 6
Environmental Engineering: Environmental Pollution, Environmental Acts and Regulations, Functional Concepts of Ecology, Basics of Species, Biodiversity, Ecosystem, Hydrological Cycle; Chemical Cycles: Carbon, Nitrogen & Phosphorus; Energy Flow in Ecosystems.
Water Pollution: Water Quality standards, Introduction to Treatment & Disposal of Waste Water. Reuse and Saving of Water, Rain Water Harvesting. Solid Waste Management: Classification of Solid Waste, Collection, Transportation and Disposal of Solid. Recycling of Solid Waste: Energy Recovery, Sanitary Landfill, On-Site Sanitation. Air & Noise Pollution: Primary and Secondary air pollutants, Harmful effects of Air Pollution, Control of Air Pollution. . Noise Pollution Harmful Effects of noise pollution, control of noise pollution, Global warming & Climate Change, Ozone depletion, Greenhouse effect
Text Books:
1. Palancharmy, Basic Civil Engineering, McGraw Hill publishers.
2. Satheesh Gopi, Basic Civil Engineering, Pearson Publishers.
3. Ketki Rangwala Dalal, Essentials of Civil Engineering, Charotar Publishing House.
4. BCP, Surveying volume 1
Leveraging Generative AI to Drive Nonprofit InnovationTechSoup
In this webinar, participants learned how to utilize Generative AI to streamline operations and elevate member engagement. Amazon Web Service experts provided a customer specific use cases and dived into low/no-code tools that are quick and easy to deploy through Amazon Web Service (AWS.)
How Barcodes Can Be Leveraged Within Odoo 17Celine George
In this presentation, we will explore how barcodes can be leveraged within Odoo 17 to streamline our manufacturing processes. We will cover the configuration steps, how to utilize barcodes in different manufacturing scenarios, and the overall benefits of implementing this technology.
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...EduSkills OECD
Andreas Schleicher, Director of Education and Skills at the OECD presents at the launch of PISA 2022 Volume III - Creative Minds, Creative Schools on 18 June 2024.
2. I/O Streams and Standard I/O
Devices
I/O stands for input/output.
An I/O Stream is a sequence of bytes
traveling from a source to a destination.
⚫ An input stream is a sequence of characters
from an input device (such as the keyboard)
to the computer.
⚫ An output stream is a sequence of characters
from the computer to an output device (such
as the monitor).
2
C++ Programming: From Problem
Analysis to Program Design, Seventh
Edition
3. I/O Streams and Standard I/O
Devices (cont’d.)
You must include the iostream header file in any
program that receives data from the keyboard or
sends output to the screen. You do this with the
preprocessor directive: #include <iostream>
⚫ This header file declares two important
variables:
cin (which stands for “common input”)
cout (which stands for “common output”)
⚫ The data types of these variables are
istream and ostream. These data types are
defined in the iostream header file.
3
C++ Programming: From Problem
Analysis to Program Design, Seventh
Edition
4. cin and
the Stream Extraction Operator >>
The extraction operator >> is the most
common way of reading a value from the
keyboard into a variable.
syntax:
The >> operator is a binary operator.
⚫ The left-side operand must be an input
stream variable, such as cin.
⚫ The right-side operand must be a declared
variable.
4
5. Example of a cin statement using >>:
int num1;
cin >> num1;
When this code executes, the program will
wait until the user types a value and
presses the Enter key. The program will
then assign the user’s value to the variable
named num1.
5
cin and
the Stream Extraction Operator >> (cont’d.)
6. There’s no difference between a
single cin with multiple variables
and multiple cin statements with
one variable each.
⚫ Example with one cin statement:
cin >> num1 >> num2;
⚫ Equivalent example with two cin
statements:
cin >> num1;
cin >> num2;
6
cin and
the Stream Extraction Operator >> (cont’d.)
7. The Extraction Operator and Various
Data Types
• The next few slides examine how the >>
operator behaves when you use it to read
values into variables of different data types
(char, int, double, string, …).
• In all of these cases, the >> operator skips
any leading whitespace.
• Recall that whitespace includes blanks, tabs,
and line returns.
• As we’ll see later, there are other ways of
reading in values that don’t skip leading
whitespace.
8. The Extraction Operator and
char data
When reading data into a char variable:
⚫ In C++, the extraction operator (>>) is
used for input operations, usually to
extract data from an input stream like
std::cin. It is often used to read user
input or read data from a file.
⚫ Reading stops after a single character
(واحد حرف بعد القراءة )تتوقف.
Example: suppose we’re executing this code:
char myChar;
cin >> myChar;
⚫ If the user types +23.47hello there! followed by
the Enter key, myChar will hold the value '+'.
8
9. The Extraction Operator and
int data
When reading data into an int variable:
⚫ >> skips leading whitespace, reads + or - sign
(if any), reads the digits.
⚫ Reading stops on any character that is not a
digit.( اًمرق ليس حرف أي على القراءة تتوقف
. )
Example: suppose we’re executing this code:
int myInt;
cin >> myInt;
⚫ If the user types -23.47hello there! followed
by the Enter key, myInt will hold the value
-23.
9
10. The Extraction Operator and
double data
When reading data into a double variable:
⚫ >> skips leading whitespace, reads + or - sign
(if any), reads the digits (including decimal
point).
⚫ Reading stops on any character that is not a
digit or the decimal point or e or E or + or -.
Example: suppose we’re executing this code:
double myDouble;
cin >> myDouble;
⚫ If the user types +23.47hello there!
followed by the Enter key, myDouble will hold
the value 23.47. 10
11. The Extraction Operator and
string data
When reading data into a string variable:
⚫ >> skips leading whitespace.
⚫ Reading stops at any whitespace
character ( بيضاء مسافة حرف أي عند القراءة تتوقف
. ).
Example: suppose we’re executing this code:
string myString;
cin >> myString;
⚫ If the user types +23.47hello there!
followed by the Enter key, myString will hold
the value "+23.47hello".
11
12. Input Failure اإلدخال فشل
An error called input failure can result if the user
enters data of a different type from the type
expected by the cin statement.
Example: suppose we’re executing this code:
int num1;
cin >> num1;
⚫ If the user types H followed by the Enter key, we’ll get an error
since the user did not enter an integer value.
As we’ll see later, C++ gives you tools to deal with this sort
of error.
12
13. Using Predefined Functions in a Program
Recall that a function is a named set of
instructions that accomplishes some task.
Recall also that the main function executes
when a program is run as main( )
Other functions execute only when called.
C++ includes a wealth of predefined functions.
⚫ These predefined functions are organized into the
header files (such as <iostream> and <string>) in the
C++ Standard Library.
13
البرنامج في اًقمسب محددة وظائف استخدام
14. Using Predefined Functions in
a Program (cont’d.)
To use a predefined function, you
must include the appropriate header
file.
⚫ You also need to know:
The function’s name
The number of parameters required
The type of each parameter
14
C++ Programming: From Problem
Analysis to Program Design, Seventh
Edition
15. Example of a Predefined
Function: pow
The pow function raises a number to a
power.
To use pow, include the cmath header file:
#include <cmath>
The pow function takes two numeric
parameters:
⚫ Syntax: pow(x,y)
This expression returns the value of xy.
x and y are the parameters.
In pow(2,3), the parameters are 2 and 3.
16. •As we’ll see in the weeks ahead, the syntax used in
calling pow on the previous slide is the same syntax
that we’ll use in calling other functions.
•In particular, the syntax consists of the
function’s name followed by zero or more
parameters enclosed in parentheses and separated
by commas.
•See the book’s Appendix F for other functions in
cmath, such as sqrt(x).
Function-Call Syntax
17. •The iostream header file defines many functions for
processing keyboard input, including:
•getLine
•get
•ignore
•putback
•peek
•clear
•Depending on what you're trying to do, you might need
to use these functions instead of (or in addition to) the
extraction operator >>.
Some Predefined Functions in
the iostream Header File
These two are the most useful.
18. cin and the getLine Function
Recall that the >> operator can read a
string into a variable of the string data
type, but that reading skips leading
whitespace and stops when it hits
whitespace after any text.
التشغيل عامل أن تذكر
>>
ف نصية سلسلة قراءة يمكنه
ي
تتخطى القراءة هذه لكن ،السلسلة بيانات نوع من متغير
مس إلى تصل عندما وتتوقف البادئة البيضاء المسافة
افة
نص أي بعد بيضاء
.
18
19. cin and the getLine Function
Alternatively, you can use the getline function.
⚫ It does not skip leading whitespace, as >> does.
⚫ And it reads until the end of the current line. It does not stop
reading when it hits whitespace, as >> does.
ذلك من ًالوبد
وظيفة استخدام يمكنك ،
getline.
⚫
يفعل كما ،البادئة البيضاء المسافة يتخطى وال
>>
.
نهاية حتى ويقرأ
السطر
الحالي
.
⚫
يفعل كما ،بيضاء مسافة إلى يصل عندما القراءة عن يتوقف وال
>>
.
Syntax:
where strVar is a string variable.
19
getline(cin, strVar);
20. cin and the getLine Function (cont’d.)
Recalling an earlier example, suppose we’re
executing this code:
string myString;
cin >> myString;
⚫ If the user types +23.47hello there! followed by the
Enter key, myString will hold the value "+23.47hello".
But if instead the code is :
string myString;
getline(cin, myString);
⚫ Now if the user types +23.47hello there!
followed by the Enter key, myString will hold
the value
" +23.47hello there!". 20
21. cin and the get Function
The get function:
⚫ Inputs the next character
(including whitespace).
⚫ Stores the character in the char
variable named as the function's
parameter.
The syntax of the get function:
where varChar is a char variable.
21
22. cin and the get Function (cont’d.)
Recalling an earlier example, suppose we’re
executing this code:
char myChar;
cin >> myChar;
⚫ If the user types +23.47hello there! followed by the
Enter key, myChar will hold the value '+'.
But if instead the code is :
char myChar;
cin.get(myChar);
⚫ Now if the user types +23.47hello there!
followed by the Enter key, myChar will hold the
value '+'.
22
23. cin and the ignore Function
The ignore function discards a portion of the input
stream.
Syntax:
– intExp is an integer expression.
– chExp is a char expression.
If intExp value's is m, the statement says to ignore the
next m characters or all characters up to and including
the character specified by chExp (whichever comes
first).
23
25. putback Function
The putback function places the
previous character extracted by
the get function from an input
stream back to that stream.
Syntax:
where varChar is a char variable.
25
C++ Programming: From Problem
Analysis to Program Design, Seventh
Edition
cin.putback(varChar);
26. peek Function
The peek function:
⚫ In C++, the peek function is a member
function of the std::istream class,
typically used with the std::cin object.
⚫ It allows you to peek at the next
character in the input stream without
actually extracting it.
⚫ Syntax:
where varChar is a char variable.
26
C++ Programming: From Problem
Analysis to Program Design, Seventh
Edition
varChar = cin.peek();