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.
C++ programs are converted to machine-readable code through compilation. The document outlines the basics of C++ programming, including compilers, program structure, variables, data types, input/output, and basic elements like identifiers, literals, operators, and comments. It provides examples of simple C++ programs and explains how they work, demonstrating concepts like printing output, declaring variables to store values, and performing calculations.
intro to programming languge c++ for computer departmentMemMem25
The document presents an introduction to C++ programming, covering its history, basic program construction, and essential components such as functions, variables, and input/output. It details syntax elements like preprocessor directives, namespaces, and the significance of keywords and identifiers, along with how to perform operations and manage data types. Additionally, it explains the use of streams for I/O operations and outlines the characteristics and compatibility of different data types.
Introduction to cpp language and all the required information relating to itPushkarNiroula1
C++ is an object-oriented programming language developed in the early 1980s as an extension of C with additional features like classes, inheritance, and function overloading. A simple C++ program prints a string to the screen using the cout output stream and iostream header. C++ programs typically contain functions, comments, and use operators like << for output and >> for input.
This document discusses the basic structure of C++ programs. It covers preprocessor directives, header files, the main function, and return statements. It provides examples of a simple Hello World program structure and explains each part. It also lists common C++ header files and their purposes.
fundamental of c++ for students of b.tech iii rd year studentSomesh Kumar
The document provides an overview of the C++ programming language, detailing its history, syntax, and basic structure. It covers the introduction of C++, key concepts such as comments, output/input operators, the program structure including the main function, and the role of tokens and data types in C++. Additionally, it includes examples of simple C++ programs and explanations of user-defined data types, enumerated types, and symbolic constants.
The document provides an introduction to computer programming and the C++ programming language. It discusses what a computer program is, different types of programs, and the process of computer programming. It then covers key concepts in C++ programming including data types, variables, constants, input/output, and basic program structure. The document is intended to teach programming fundamentals and provide an overview of C++ for beginners.
The document provides an introduction to fundamentals of C++ programming. It discusses C++ program structure including comments, preprocessor directives, header files, the main function and return statements. It also covers data types, variables, constants, naming conventions. The compiling process and different types of errors in programming such as syntax errors, logical errors and runtime errors are described.
The document provides an introduction to C++ programming including setting up a compiler, the structure of a basic C++ program, variables, and input/output. It explains that a compiler is needed to convert C++ code into an executable. The main() function is called at startup and returns an integer value. A basic "Hello World" program is shown using #include, cout, and cin.get(). Variables are declared with a data type like int or char and stored user input. Comments are added using // or /* */.
The document provides an overview of the history and features of the C++ programming language, detailing its origins from the C language developed at Bell Labs in the early 1970s. It discusses the advantages of C++, including its object-oriented nature, reusability of code, and standardization, as well as basic programming concepts like variables, input/output operations, and comments. Additionally, it explains the process of compiling a C++ program and includes simple program examples demonstrating these concepts.
C++ is an object-oriented programming language developed in the early 1980s, serving as a successor to C, which is a procedural language. Key features of C++ include encapsulation, inheritance, polymorphism, and abstraction, which enhance software modularity, reusability, and maintainability. The document also outlines the process of writing, compiling, and executing C++ programs, and differentiates between references and pointers.
Here is the class Book with the requested attributes and member functions:
#include <iostream>
using namespace std;
class Book {
private:
string title;
string author;
string publisher;
float price;
public:
Book() {
title = "No title";
author = "No author";
publisher = "No publisher";
price = 0.0;
}
void display_data() {
cout << "Title: " << title << endl;
cout << "Author: " << author << endl;
cout << "Publisher: " << publisher << endl;
cout << "Price: " << price << endl;
}
The document provides an overview of the Code::Blocks IDE, detailing its features, installation process, and project creation in C++. It explains the structure of C++ programs, including components like variables, functions, and operators, while highlighting essential coding concepts. Additionally, it outlines keyboard shortcuts and discusses key programming elements such as comments, data types, and operator precedence.
This document provides an overview of basic programming concepts for students to understand, including:
1) Comments, preprocessor directives, header files, the main function, identifiers, special symbols, and punctuation that are elements of programming languages.
2) Explanations and examples of each concept like how comments annotate source code, preprocessor directives process special instructions, and header files contain function declarations.
3) The goal for students to be able to identify and understand these fundamental programming concepts after completing this chapter.
This document provides an overview of the basic structure and components of a C++ program. It summarizes:
- The main() function is the starting point of execution for a C++ program and contains the program logic.
- Preprocessor directives like #include are used to incorporate header files containing declarations needed by the program.
- The using namespace std directive allows the program to access standard library components like cout without specifying the std namespace.
- The cout object outputs text to the screen via the insertion operator <<.
This document serves as an introduction to C++, covering its history, syntax, and fundamental concepts such as data types, variables, and user input. It provides code examples demonstrating how to write C++ programs, including the use of cout for output, cin for input, and the declaration of various data types. The content is structured to help beginners understand the basics of C++ programming, including operators, comments, and the use of functions.
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.
This document is the first lesson of a C++ programming tutorial. It introduces the basics of C++, including how to set up a compiler, the structure of a basic C++ program with a main function, and how to use header files, namespaces, functions like cout and cin, and comments. The example program provided prints "Hello World" and uses cout to output text and cin.get() to pause the window until a key is pressed. Comments are explained as a way to describe code without the compiler treating it as executable statements.
This document is the first lesson of a C++ programming tutorial. It introduces the basics of C++, including how to set up a compiler, the structure of a basic C++ program with a main function, and how to use header files, namespaces, functions like cout and cin, and comments. The example program provided prints "Hello World" and uses cout to output text and cin.get() to pause the window until a key is pressed. Comments are explained as a way to add explanatory text to programs without affecting the code.
This document introduces C++ and provides an overview of its key components. It discusses how C++ extends the C language with object-oriented programming capabilities. It also describes C++ keywords, identifiers, comments, compiler directives, and common programming conventions like proper indentation and commenting. An example C++ program is provided that translates an example conversation into code.
Beginner C++ easy slide and simple definition with questions khawajasharif
The document provides an introduction to the C++ programming language, describing it as a general-purpose language derived from C. It outlines the basic structure of a C++ program, including the main function, the use of streams for input and output, and the importance of semicolons to terminate statements. Additionally, it covers comments in code, explaining single-line and multi-line formats, which are ignored by the compiler.
Paksitan Zindabad in ITDevelopment of ITssuser6aa405
This document covers the basics of programming in C++, including the role of programmers, the components of computer systems (hardware and software), and the programming process. It explains how programs are structured, the importance of algorithms, and the steps involved in creating executable files from source code. Key programming concepts such as variables, data types, and input/output operations are also introduced.
Object oriented programming 11 preprocessor directives and program structureVaibhav Khanna
The document provides an overview of preprocessor directives, program structure, and syntax in C++. It explains how to include header files, use the `cin` and `cout` functions, and the importance of proper syntax and documentation in programming. Additionally, it covers variable declaration styles, assignment statements, and the significance of maintaining readability in code.
The document discusses editing, compiling, and executing a simple C++ program. It begins with an overview of basic C++ programming elements and concepts like tokens, data types, arithmetic operators, and precedence. It then provides examples of simple C++ programs that perform arithmetic calculations and output results. The document emphasizes that understanding programming fundamentals like variables, data types, expressions, and control flow is necessary before writing even basic C++ programs.
This document serves as an introduction to C++ programming, outlining steps to compile and run a simple C++ program that prints 'hello world' to the screen. It emphasizes software development principles, including the importance of comments, function structure, and error handling, as well as the concept of use cases in software design. Additionally, it briefly discusses UML diagrams and the need for specific programming practices to enhance code readability and maintainability.
The document provides an introduction to C++ programming, outlining the steps to compile and run a simple 'hello world' program while explaining key concepts such as comments, the main function, and output statements. It emphasizes good programming practices like proper indentation and the inclusion of comments for documentation. Additionally, it briefly touches on software modification and introduces UML diagrams and use cases, including examples related to banking transactions.
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...Alluxio, Inc.
Alluxio Webinar
June 10, 2025
For more Alluxio Events: https://www.alluxio.io/events/
Speaker:
David Zhu (Engineering Manager @ Alluxio)
Storing data as Parquet files on cloud object storage, such as AWS S3, has become prevalent not only for large-scale data lakes but also as lightweight feature stores for training and inference, or as document stores for Retrieval-Augmented Generation (RAG). However, querying petabyte-to-exabyte-scale data lakes directly from S3 remains notoriously slow, with latencies typically ranging from hundreds of milliseconds to several seconds.
In this webinar, David Zhu, Software Engineering Manager at Alluxio, will present the results of a joint collaboration between Alluxio and a leading SaaS and data infrastructure enterprise that explored leveraging Alluxio as a high-performance caching and acceleration layer atop AWS S3 for ultra-fast querying of Parquet files at PB scale.
David will share:
- How Alluxio delivers sub-millisecond Time-to-First-Byte (TTFB) for Parquet queries, comparable to S3 Express One Zone, without requiring specialized hardware, data format changes, or data migration from your existing data lake.
- The architecture that enables Alluxio’s throughput to scale linearly with cluster size, achieving one million queries per second on a modest 50-node deployment, surpassing S3 Express single-account throughput by 50x without latency degradation.
- Specifics on how Alluxio offloads partial Parquet read operations and reduces overhead, enabling direct, ultra-low-latency point queries in hundreds of microseconds and achieving a 1,000x performance gain over traditional S3 querying methods.
Integrating Survey123 and R&H Data Using FMESafe Software
West Virginia Department of Transportation (WVDOT) actively engages in several field data collection initiatives using Collector and Survey 123. A critical component for effective asset management and enhanced analytical capabilities is the integration of Geographic Information System (GIS) data with Linear Referencing System (LRS) data. Currently, RouteID and Measures are not captured in Survey 123. However, we can bridge this gap through FME Flow automation. When a survey is submitted through Survey 123 for ArcGIS Portal (10.8.1), it triggers FME Flow automation. This process uses a customized workbench that interacts with a modified version of Esri's Geometry to Measure API. The result is a JSON response that includes RouteID and Measures, which are then applied to the feature service record.
More Related Content
Similar to computer programming omputer programming (20)
The document provides an introduction to C++ programming including setting up a compiler, the structure of a basic C++ program, variables, and input/output. It explains that a compiler is needed to convert C++ code into an executable. The main() function is called at startup and returns an integer value. A basic "Hello World" program is shown using #include, cout, and cin.get(). Variables are declared with a data type like int or char and stored user input. Comments are added using // or /* */.
The document provides an overview of the history and features of the C++ programming language, detailing its origins from the C language developed at Bell Labs in the early 1970s. It discusses the advantages of C++, including its object-oriented nature, reusability of code, and standardization, as well as basic programming concepts like variables, input/output operations, and comments. Additionally, it explains the process of compiling a C++ program and includes simple program examples demonstrating these concepts.
C++ is an object-oriented programming language developed in the early 1980s, serving as a successor to C, which is a procedural language. Key features of C++ include encapsulation, inheritance, polymorphism, and abstraction, which enhance software modularity, reusability, and maintainability. The document also outlines the process of writing, compiling, and executing C++ programs, and differentiates between references and pointers.
Here is the class Book with the requested attributes and member functions:
#include <iostream>
using namespace std;
class Book {
private:
string title;
string author;
string publisher;
float price;
public:
Book() {
title = "No title";
author = "No author";
publisher = "No publisher";
price = 0.0;
}
void display_data() {
cout << "Title: " << title << endl;
cout << "Author: " << author << endl;
cout << "Publisher: " << publisher << endl;
cout << "Price: " << price << endl;
}
The document provides an overview of the Code::Blocks IDE, detailing its features, installation process, and project creation in C++. It explains the structure of C++ programs, including components like variables, functions, and operators, while highlighting essential coding concepts. Additionally, it outlines keyboard shortcuts and discusses key programming elements such as comments, data types, and operator precedence.
This document provides an overview of basic programming concepts for students to understand, including:
1) Comments, preprocessor directives, header files, the main function, identifiers, special symbols, and punctuation that are elements of programming languages.
2) Explanations and examples of each concept like how comments annotate source code, preprocessor directives process special instructions, and header files contain function declarations.
3) The goal for students to be able to identify and understand these fundamental programming concepts after completing this chapter.
This document provides an overview of the basic structure and components of a C++ program. It summarizes:
- The main() function is the starting point of execution for a C++ program and contains the program logic.
- Preprocessor directives like #include are used to incorporate header files containing declarations needed by the program.
- The using namespace std directive allows the program to access standard library components like cout without specifying the std namespace.
- The cout object outputs text to the screen via the insertion operator <<.
This document serves as an introduction to C++, covering its history, syntax, and fundamental concepts such as data types, variables, and user input. It provides code examples demonstrating how to write C++ programs, including the use of cout for output, cin for input, and the declaration of various data types. The content is structured to help beginners understand the basics of C++ programming, including operators, comments, and the use of functions.
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.
This document is the first lesson of a C++ programming tutorial. It introduces the basics of C++, including how to set up a compiler, the structure of a basic C++ program with a main function, and how to use header files, namespaces, functions like cout and cin, and comments. The example program provided prints "Hello World" and uses cout to output text and cin.get() to pause the window until a key is pressed. Comments are explained as a way to describe code without the compiler treating it as executable statements.
This document is the first lesson of a C++ programming tutorial. It introduces the basics of C++, including how to set up a compiler, the structure of a basic C++ program with a main function, and how to use header files, namespaces, functions like cout and cin, and comments. The example program provided prints "Hello World" and uses cout to output text and cin.get() to pause the window until a key is pressed. Comments are explained as a way to add explanatory text to programs without affecting the code.
This document introduces C++ and provides an overview of its key components. It discusses how C++ extends the C language with object-oriented programming capabilities. It also describes C++ keywords, identifiers, comments, compiler directives, and common programming conventions like proper indentation and commenting. An example C++ program is provided that translates an example conversation into code.
Beginner C++ easy slide and simple definition with questions khawajasharif
The document provides an introduction to the C++ programming language, describing it as a general-purpose language derived from C. It outlines the basic structure of a C++ program, including the main function, the use of streams for input and output, and the importance of semicolons to terminate statements. Additionally, it covers comments in code, explaining single-line and multi-line formats, which are ignored by the compiler.
Paksitan Zindabad in ITDevelopment of ITssuser6aa405
This document covers the basics of programming in C++, including the role of programmers, the components of computer systems (hardware and software), and the programming process. It explains how programs are structured, the importance of algorithms, and the steps involved in creating executable files from source code. Key programming concepts such as variables, data types, and input/output operations are also introduced.
Object oriented programming 11 preprocessor directives and program structureVaibhav Khanna
The document provides an overview of preprocessor directives, program structure, and syntax in C++. It explains how to include header files, use the `cin` and `cout` functions, and the importance of proper syntax and documentation in programming. Additionally, it covers variable declaration styles, assignment statements, and the significance of maintaining readability in code.
The document discusses editing, compiling, and executing a simple C++ program. It begins with an overview of basic C++ programming elements and concepts like tokens, data types, arithmetic operators, and precedence. It then provides examples of simple C++ programs that perform arithmetic calculations and output results. The document emphasizes that understanding programming fundamentals like variables, data types, expressions, and control flow is necessary before writing even basic C++ programs.
This document serves as an introduction to C++ programming, outlining steps to compile and run a simple C++ program that prints 'hello world' to the screen. It emphasizes software development principles, including the importance of comments, function structure, and error handling, as well as the concept of use cases in software design. Additionally, it briefly discusses UML diagrams and the need for specific programming practices to enhance code readability and maintainability.
The document provides an introduction to C++ programming, outlining the steps to compile and run a simple 'hello world' program while explaining key concepts such as comments, the main function, and output statements. It emphasizes good programming practices like proper indentation and the inclusion of comments for documentation. Additionally, it briefly touches on software modification and introduces UML diagrams and use cases, including examples related to banking transactions.
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...Alluxio, Inc.
Alluxio Webinar
June 10, 2025
For more Alluxio Events: https://www.alluxio.io/events/
Speaker:
David Zhu (Engineering Manager @ Alluxio)
Storing data as Parquet files on cloud object storage, such as AWS S3, has become prevalent not only for large-scale data lakes but also as lightweight feature stores for training and inference, or as document stores for Retrieval-Augmented Generation (RAG). However, querying petabyte-to-exabyte-scale data lakes directly from S3 remains notoriously slow, with latencies typically ranging from hundreds of milliseconds to several seconds.
In this webinar, David Zhu, Software Engineering Manager at Alluxio, will present the results of a joint collaboration between Alluxio and a leading SaaS and data infrastructure enterprise that explored leveraging Alluxio as a high-performance caching and acceleration layer atop AWS S3 for ultra-fast querying of Parquet files at PB scale.
David will share:
- How Alluxio delivers sub-millisecond Time-to-First-Byte (TTFB) for Parquet queries, comparable to S3 Express One Zone, without requiring specialized hardware, data format changes, or data migration from your existing data lake.
- The architecture that enables Alluxio’s throughput to scale linearly with cluster size, achieving one million queries per second on a modest 50-node deployment, surpassing S3 Express single-account throughput by 50x without latency degradation.
- Specifics on how Alluxio offloads partial Parquet read operations and reduces overhead, enabling direct, ultra-low-latency point queries in hundreds of microseconds and achieving a 1,000x performance gain over traditional S3 querying methods.
Integrating Survey123 and R&H Data Using FMESafe Software
West Virginia Department of Transportation (WVDOT) actively engages in several field data collection initiatives using Collector and Survey 123. A critical component for effective asset management and enhanced analytical capabilities is the integration of Geographic Information System (GIS) data with Linear Referencing System (LRS) data. Currently, RouteID and Measures are not captured in Survey 123. However, we can bridge this gap through FME Flow automation. When a survey is submitted through Survey 123 for ArcGIS Portal (10.8.1), it triggers FME Flow automation. This process uses a customized workbench that interacts with a modified version of Esri's Geometry to Measure API. The result is a JSON response that includes RouteID and Measures, which are then applied to the feature service record.
In this session we cover the benefits of a migration to Cosmos DB, migration paths, common pain points and best practices. We share our firsthand experiences and customer stories. Adiom is the trusted partner for migration solutions that enable seamless online database migrations from MongoDB to Cosmos DB vCore, and DynamoDB to Cosmos DB for NoSQL.
Artificial Intelligence Applications Across IndustriesSandeepKS52
Artificial Intelligence is a rapidly growing field that influences many aspects of modern life, including transportation, healthcare, and finance. Understanding the basics of AI provides insight into how machines can learn and make decisions, which is essential for grasping its applications in various industries. In the automotive sector, AI enhances vehicle safety and efficiency through advanced technologies like self-driving systems and predictive maintenance. Similarly, in healthcare, AI plays a crucial role in diagnosing diseases and personalizing treatment plans, while in financial services, it helps in fraud detection and risk management. By exploring these themes, a clearer picture of AI's transformative impact on society emerges, highlighting both its potential benefits and challenges.
GDG Douglas - Google AI Agents: Your Next Intern?felipeceotto
Presentation done at the GDG Douglas event for June 2025.
A first look at Google's new Agent Development Kit.
Agent Development Kit is a new open-source framework from Google designed to simplify the full stack end-to-end development of agents and multi-agent systems.
Code and No-Code Journeys: The Coverage OverlookApplitools
Explore practical ways to expand visual and functional UI coverage without deep coding or heavy maintenance in this session. Session recording and more info at applitools.com
Explore innovative tools tailored for modern finance with our Money Lender Software Development, efficient Daily Pigmy Collection Software, and streamlined Personal Loan Software. This presentation showcases how these solutions simplify loan management, boost collection efficiency, and enhance customer experience for NBFCs, microfinance firms, and individual lenders.
Generative Artificial Intelligence and its ApplicationsSandeepKS52
The exploration of generative AI begins with an overview of its fundamental concepts, highlighting how these technologies create new content and ideas by learning from existing data. Following this, the focus shifts to the processes involved in training and fine-tuning models, which are essential for enhancing their performance and ensuring they meet specific needs. Finally, the importance of responsible AI practices is emphasized, addressing ethical considerations and the impact of AI on society, which are crucial for developing systems that are not only effective but also beneficial and fair.
Looking for a BIRT Report Alternative Here’s Why Helical Insight Stands Out.pdfVarsha Nayak
The search for an Alternative to BIRT Reports has intensified as companies face challenges with BIRT's steep learning curve, limited visualization capabilities, and complex deployment requirements. Organizations need reporting solutions that offer intuitive design interfaces, comprehensive analytics features, and seamless integration capabilities – all while maintaining the reliability and performance that enterprise environments demand.
How the US Navy Approaches DevSecOps with Raise 2.0Anchore
Join us as Anchore's solutions architect reveals how the U.S. Navy successfully approaches the shift left philosophy to DevSecOps with the RAISE 2.0 Implementation Guide to support its Cyber Ready initiative. This session will showcase practical strategies for defense application teams to pivot from a time-intensive compliance checklist and mindset to continuous cyber-readiness with real-time visibility.
Learn how to break down organizational silos through RAISE 2.0 principles and build efficient, secure pipeline automation that produces the critical security artifacts needed for Authorization to Operate (ATO) approval across military environments.
What is data visualization and how data visualization tool can help.pdfVarsha Nayak
An open source data visualization tool enhances this process by providing flexible, cost-effective solutions that allow users to customize and scale their visualizations according to their needs. These tools enable organizations to make data-driven decisions with complete freedom from proprietary software limitations. Whether you're a data scientist, marketer, or business leader, understanding how to utilize an open source data visualization tool can significantly improve your ability to communicate insights effectively.
INTRODUCTION:TRANSMISSION MEDIA
• A transmission media in data communication is a physical path between the sender and
the receiver and it is the channel through which data can be sent from one location to
another. Data can be represented through signals by computers and other sorts of
telecommunication devices. These are transmitted from one device to another in the
form of electromagnetic signals. These Electromagnetic signals can move from one
sender to another receiver through a vacuum, air, or other transmission media.
Electromagnetic energy mainly includes radio waves, visible light, UV light, and gamma
ra
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWSBradBedford3
Creating meaningful, real-time engagement across channels is essential to building lasting business relationships. Discover how AWS, in collaboration with Deloitte, set up one of Adobe's first instances of Journey Optimizer B2B Edition to revolutionize customer journeys for B2B audiences.
This session will share the use cases the AWS team has the implemented leveraging Adobe's Journey Optimizer B2B alongside Marketo Engage and Real-Time CDP B2B to deliver unified, personalized experiences and drive impactful engagement.
They will discuss how they are positioning AJO B2B in their marketing strategy and how AWS is imagining AJO B2B and Marketo will continue to work together in the future.
Whether you’re looking to enhance customer journeys or scale your B2B marketing efforts, you’ll leave with a clear view of what can be achieved to help transform your own approach.
Speakers:
Britney Young Senior Technical Product Manager, AWS
Erine de Leeuw Technical Product Manager, AWS
Zoneranker’s Digital marketing solutionsreenashriee
Zoneranker offers expert digital marketing services tailored for businesses in Theni. From SEO and PPC to social media and content marketing, we help you grow online. Partner with us to boost visibility, leads, and sales.
Automated Migration of ESRI Geodatabases Using XML Control Files and FMESafe Software
Efficient data migration is a critical challenge in geospatial data management, especially when working with complex data structures. This presentation explores an automated approach to migrating ESRI Geodatabases using FME and XML-based control files. A key advantage of this method is its adaptability: changes to the data model are seamlessly incorporated into the migration process without requiring modifications to the underlying FME workflow. By separating data model definitions from migration logic, this approach ensures flexibility, reduces maintenance effort, and enhances scalability.
AI and Deep Learning with NVIDIA TechnologiesSandeepKS52
Artificial intelligence and deep learning are transforming various fields by enabling machines to learn from data and make decisions. Understanding how to prepare data effectively is crucial, as it lays the foundation for training models that can recognize patterns and improve over time. Once models are trained, the focus shifts to deployment, where these intelligent systems are integrated into real-world applications, allowing them to perform tasks and provide insights based on new information. This exploration of AI encompasses the entire process from initial concepts to practical implementation, highlighting the importance of each stage in creating effective and reliable AI solutions.
Wondershare PDFelement Pro 11.4.20.3548 Crack Free DownloadPuppy jhon
➡ 🌍📱👉COPY & PASTE LINK👉👉👉 ➤ ➤➤ https://drfiles.net/
Wondershare PDFelement Professional is professional software that can edit PDF files. This digital tool can manipulate elements in PDF documents.
2. Structure of C++ Program
A C++ program has the following structure
Comments:- single line and multiple line comment
Preprocessor directives:- All the preprocessor directives in C++ start
with the # (hash) symbol
Global variable declarations:-A global variable can be accessed from
anywhere in the entire program. It is usually declared at the top or
start of the program outside of all blocks and functions of the
program.
Prototypes of functions:-A function prototype begins with the
keyword function, then lists the function name, its parameters (if
any), and return value (if any).
Definitions of functions:-A function is a block of code which only runs
when it is called.
3. C++ Integrated Development
Environment(IDE)
An Integrated Development Environment (IDE) is a software suite that
combines tools needed for software development, such as a code editor,
debugger, and build automation tools, into one user-friendly interface.
It often includes features like code completion and version control
integration.
The complete development cycle in C++ is: Write the program, compile the
source code, link the program, and run it.
•Writing: Using a text editor to create C++ source files (.cpp).
•Compiling: Using a C++ compiler to translate source code into object files.
•Linking: Combining object files into an executable program.
•Running: Executing the program to see its output or behavior.
4. Cont.…
Writing a Program
To write a source code, your compiler may have its own built-in text editor, or you
may be using a commercial text editor or word processor that can produce text
files.
The important thing is that whatever you write your program in, it must save
simple, plain-text files, with no word processing commands embedded in the text.
Simple editors like Notepad (on Windows) or TextEdit (on macOS).
Specialized editors like Visual Studio Code, Code::Blocks, Dev C++,
NetBeans, Quincy, Sublime Text, or Atom.
The files you create with your editor are called source files, and for C++ they
typically are named with the extension .CPP.
For example, you might create a file named hello.cpp.
5. Compiling
Your source code file can't be executed, or run, as a program can.
To turn your source code into a program, you use a compiler.
How you invoke your compiler, and how you tell it where to find your
source code, will vary from compiler to compiler.
In Borland's Turbo C++ you pick the RUN menu command or type tc
<filename>
from the command line, where <filename> is the name of your source
code file (for example, test.cpp).
Other compilers may do things slightly differently.
After your source code is compiled, an object file is produced.
This file is often named with the extension .OBJ.
This is still not an executable program, however,to turn this into an
executable program, you must run your linker.
Cont.…
6. • Linking
• C++ programs are typically created by linking together one or more OBJ
files with one or more libraries.
• A library is a collection of linkable files that were supplied with your
compiler, that you purchased separately, or that you created and
compiled.
• All C++ compilers come with a library of useful functions (or
procedures) and classes that you can include in your program.
• A function is a block of code that performs a service, such as adding
two numbers or printing to the screen.
• A class is a collection of data and related functions.
Cont.…
7. Summary
The steps to create an executable file are
1. Create a source code file, with a .CPP extension.
2. Compile the source code into a file with the .OBJ extension.
3. Link your OBJ file with any needed libraries to produce an executable program.
Cont.…
Showing Sample program
Any meaningful program written in C++ has to contain a number of
components:
the main function;
some variable declarations; and
some executable statements.
8. For example, the following is a very basic C++ program:
#include <iostream.h>
int main()
{
cout << "Hello World!n";
return 0;
}
The first character is the (#) pound symbol, which is a signal to the
preprocessor.
Each time you start your compiler, the preprocessor is run.
include is a preprocessor instruction that says, "What follows is a
filename. Find that file and read it in right here.“
Every C++ program has a main() function.
cout is used in C++ to print strings and values to the screen.
Cont.…
9. • The preprocessor reads through your source code, looking for lines that
begin with the pound symbol (#), and acts on those lines before the
compiler runs.
• The angle brackets around the filename tell the preprocessor to look in all
the usual places for this file.
• If your compiler is set up correctly, the angle brackets will cause the
preprocessor to look for the file iostream.h in the directory that holds all the
H files for your compiler.
• The file iostream.h (Input-Output-Stream) is used by cout, which assists
with writing to the screen.
• The effect of line 1 is to include the file iostream.h into this program as if
you had typed it in yourself.
Cont.…
10. • The preprocessor runs before your compiler each time the compiler is invoked.
• The preprocessor translates any line that begins with a pound symbol (#) into a special
command, getting your code file ready for the compiler.
• Line 2 begins the actual program with a function named main().
• In general, a function is a block of code that performs one or more actions.
• Usually functions are invoked or called by other functions, but main() is special.
• When your program starts, main() is called automatically.
• main(), like all functions, must state what kind of value it will return.
• The return value type for main() in HELLO.CPP is int, which means that this function will
return an integer value.
Cont.…
11. • All functions begin with an opening brace ({) and end with a
closing brace (}).
• The braces for the main() function are on lines 3 and 6.
• Everything between the opening and closing braces is
considered a part of the function.
• The meat and potatoes of this program is on line 4.
• The object cout is used to print a message to the screen.
• A string is just a set of characters.
Cont.…
12. • Here's how cout is used: type the word cout, followed by the output
redirection operator (<<).
• Whatever follows the output redirection operator is written to the screen.
• If you want a string of characters written, be sure to enclose them in double
quotes ("), as shown on line 4.
• A text string is a series of printable characters.
• The final two characters, n, tell cout to put a new line after the words Hello
World! All ANSI-compliant programs declare main() to return an int.
• This value is "returned" to the operating system when your program
completes.
• Some programmers signal an error by returning the value 1.
• The main() function ends on line 6 with the closing brace.
Cont.…
13. Basic Elements
Keywords (reserved words)
• Reserved/Key words have a unique meaning within a C++ program.
• These symbols, the reserved words, must not be used for any other
purposes.
• All reserved words are in lower-case letters.
• The following are some of the reserved words of C++.
asm auto bool break case catch
const_cast class const char continue default
dynamic_cast do double delete else enum
explicit extern false float for friend
goto if inline int long mutable
namespace new operator private protected public
reinterpret_cast register return short signed sizeof
static_cast static struct switch template this
throw true try typedef typeid typename
union unsigned using virtual void volatile
14. Notice that main is not a reserved word.
However, this is a fairly technical distinction, and for practical purposes you are advised
to treat main, cin, and cout as if they were reserved as well.
Syntax of an identifier
Identifiers
An identifier is name associated with a function or data object and used to refer to that
function or data object.
An identifier must:
Start with a letter or underscore
Consist only of letters, the digits 0-9, or the underscore symbol _
Not be a reserved word
Letter
-
Letter
Digit
-
Cont.…
15. • For the purposes of C++ identifiers, the underscore symbol, _, is
considered to be a letter.
• Its use as the first character in an identifier is not recommended
though, because many library functions in C++ use such identifiers.
• Similarly, the use of two consecutive underscore symbols, _ _, is
forbidden.
• The following are valid identifiers
Length days_in_yea
r
DataSet1 Profit95
Int _Pressure first_one first_1
Although using _Pressure is not recommended.
Cont.…
• The following are invalid:
days-in-
year
1data int first.val
throw my__best No## bestWish!
16. • Although it may be easier to type a program consisting of single
character identifiers, modifying or correcting the program becomes more
and more difficult.
• The minor typing effort of using meaningful identifiers will repay itself
many fold in the avoidance of simple programming errors when the
program is modified.
• At this stage it is worth noting that C++ is case-sensitive.
• That is lower-case letters are treated as distinct from upper-case letters.
• Thus the word NUM different from the word num or the word Num.
• Identifiers can be used to identify variable or constants or functions.
• Function identifier is an identifier that is used to name a function.
Cont.…
17. • Literals are constant values which can be a number, a character of a
string.
• For example the number 129.005, the character ‘A’ and the string “hello
world” are all literals.
• There is no identifier that identifies them.
• A comment is a piece of descriptive text which explains some aspect of
a program.
• Program comments are totally ignored by the compiler and are only
intended for human readers.
• C++ provides two types of comment delimiters:
• Anything after // (until the end of the line on which it appears) is
considered a comment.
• Anything enclosed by the pair /* and */ is considered a comment.
Cont.…
18. Data Types, Variables, and Constants
• A variable is a symbolic name for a memory location in which data can
be stored and subsequently recalled.
• Variables are used for holding data values so that they can be utilized in
various computations in a program.
• All variables have two important attributes:
• A type, which is, established when the variable is defined (e.g., integer,
float, character).
• Once defined, the type of a C++ variable cannot be changed.
• A value, which can be changed by assigning a new value to the variable.
• The kind of values a variable can assume depends on its type.
• For example, an integer variable can only take integer values (e.g., 2,
100, -12) not real numbers like 0.123.
19. Variable Declaration
• Declaring a variable means defining (creating) a variable.
• You create or define a variable by stating its type, followed by one or more
spaces, followed by the variable name and a semicolon.
• The variable name can be virtually any combination of letters, but cannot contain
spaces and the first character must be a letter or an underscore.
• Variable names cannot also be the same as keywords used by C++.
• Legal variable names include x, J23qrsnf, and myAge.
• Good variable names tell you what the variables are for; using good names makes
it easier to understand the flow of your program.
• The following statement defines an integer variable called myAge:
int myAge;
• IMPORTANT- Variables must be declared before used!
Cont.…
20. • As a general programming practice, avoid such horrific names
as J23qrsnf, and restrict single-letter variable names (such as x
or i) to variables that are used only very briefly.
• Try to use expressive names such as myAge or howMany.
• A point worth mentioning again here is that C++ is case-
sensitive.
• In other words, uppercase and lowercase letters are
considered to be different.
• A variable named age is different from Age, which is different
from AGE.
Cont.…
21. • Creating More Than One Variable at a Time
• You can create more than one variable of the same type in one
statement by writing the type and then the variable names,
separated by commas. For example:
int myAge, myWeight; // two int variables
long area, width, length; // three longs
• As you can see, myAge and myWeight are each declared as
integer variables.
• The second line declares three individual long variables named
area, width, and length.
• However keep in mind that you cannot mix types in one
definition statement.
Cont.…
22. Cont.…
Assigning Values to Your Variables
You assign a value to a variable by using the assignment operator (=).
Thus, you would assign 5 to Width by writing
int Width;
Width = 5;
You can combine these steps and initialize Width when you define it by
writing
int Width = 5;
Initialization looks very much like assignment, and with integer variables,
the difference is minor.
The essential difference is that initialization takes place at the moment
you create the variable.
23. • Just as you can define more than one variable at a time, you
can initialize more than one variable at creation. For example:
• // create two int variables and initialize them
int width = 5, length = 7;
• This example initializes the integer variable width to the value 5
and the length variable to the value 7.
• It is possible to even mix definitions and initializations:
int myAge = 39, yourAge, hisAge = 40;
• This example creates three type int variables, and it initializes
the first and third.
Cont.…
24. What is Cin and Cout in C++?
cin and cout are standard input and output streams in C++.
cin: Read input from the user.
cout: Write output to the screen.
in C++ we use 'cin' and 'cout'. 'Cin' takes the input and helps the computer
understand what you want to tell it.
'Cout' helps the computer tell you something by generating the output.
syntax
int x;
Cout<<“enter the value of the x”;
cin >>x;
cout <<"Hey there, its me";
Cont.…
25. #include <iostream.h>
int main() {
int first_number, second_number, sum;
cout << "Enter two integers: ";
cin >> first_number >> second_number; // sum of two
numbers in stored in variable sumOfTwoNumbers
sum = first_number + second_number; // prints sum
cout << first_number << " + " << second_number << " = " <<
sum;
return 0;
}
Cont.…
26. }
#include <iostream.h>;
int main()
{
int age;
string name;
cout << "What is your name? ";
cin >> name;
cout << "What is your age? ";
cin >> age;
cout << "Hello, " << name << "! You are " << age << " years
young." << endl;
return 0;
}
Cont.…
27. Basic Data Types
• When you define a variable in C++, you must tell the compiler
what kind of variable it is: an integer, a character, and so
forth.
• This information tells the compiler how much room to set aside
and what kind of value you want to store in your variable.
• Several data types are built into C++.
• The varieties of data types allow programmers to select the type
appropriate to the needs of the applications being developed.
• The data types supported by C++ can be classified as basic
(fundamental) data types, user defined data types, derived
data types and empty data types.
28. • Basic (fundamental) data types in C++ can be conveniently
divided into numeric and character types.
• Numeric variables can further be divided into integer
variables and floating-point variables.
• Integer variables will hold only integers whereas floating
number variables can accommodate real numbers.
• Both the numeric data types offer modifiers that are used to
vary the nature of the data to be stored.
• The modifiers used can be short, long, signed and unsigned.
Cont.…
29. Type Size Values
unsigned short int 2 bytes 0 to 65,535
short int(signed short int) 2 bytes -32,768 to 32,767
unsigned long int 4 bytes 0 to 4,294,967,295
long int(signed long int) 4 bytes -2,147,483,648 to 2,147,483,647
int 2 bytes -32,768 to 32,767
unsigned int 2 bytes 0 to 65,535
signed int 2 bytes -32,768 to 32,767
char 1 byte 256 character values
float 4 bytes 3.4e-38 to 3.4e38
double 8 bytes 1.7e-308 to 1.7e308
long double 10 bytes 1.2e-4932 to 1.2e4932
This table shows the variable type, how much room it takes in memory,
and what kinds of values can be stored in these variables.
The values that can be stored are determined by the size of the variable
types.
Cont.…
30. Signed and Unsigned
• Integers (short and long) without the word "unsigned" are assumed to
be signed.
• signed integers are either negative or positive.
• Unsigned integers are always positive.
• Because you have the same number of bytes for both signed and
unsigned integers, the largest number you can store in an unsigned
integer is twice as big as the largest positive number you can store in a
signed integer.
• An unsigned short integer can handle numbers from 0 to 65,535.
• Half the numbers represented by a signed short are negative, thus a
signed short can only represent numbers from -32,768 to 32,767.
Cont.…
31. Example: A demonstration of the use of variables.
#include <iostream.h>
int main()
{
unsigned short int Width = 5, Length;
Length = 10;
// create an unsigned short and initialize with
result
// of multiplying Width by Length
unsigned short int Area = Width * Length;
cout << "Width:" << Width << "n";
cout << "Length: " << Length << endl;
cout << "Area: " << Area << endl;
return 0;
}
Output: Width:5
Length: 10
Area: 50
Line 1 includes the required include
statement for the iostream's library so
that cout will work.
Line 2 begins the program.
On line 4, Width is defined as an
unsigned short integer, and its value is
initialized to 5.
Another unsigned short integer,
Length, is also defined, but it is not
initialized.
On line 5, the value 10 is assigned to
Length.
On line 8, an unsigned short integer,
Area, is defined, and it is initialized
with the value obtained by multiplying
Width times Length. On lines 9-11, the
values of the variables are printed to
the screen.
Note that the special word endl creates
a new line.
Cont.…
32. • Wrapping around integer values
• The fact that unsigned long integers have
a limit to the values they can hold is only
rarely a problem, but what happens if you
do run out of room?
• When an unsigned integer reaches its
maximum value, it wraps around and
starts over, much as a car odometer
might.
• The following example shows what
happens if you try to put too large a value
into a short integer.
Example: A demonstration of putting too large a
value in a variable
#include <iostream.h>
int main() {
unsigned short int smallNumber;
smallNumber = 65535;
cout << "small number:" << smallNumber << endl;
smallNumber++;
cout << "small number:" << smallNumber << endl;
smallNumber++;
cout << "small number:" << smallNumber << endl;
return 0;
}
Output:
small number:65535
small number:0
small number:1
Cont.…
33. • A signed integer is different from an unsigned
integer, in that half of the values you can
represent are negative.
• Instead of picturing a traditional car odometer,
you might picture one that rotates up for positive
numbers and down for negative numbers.
• One mile from 0 is either 1 or -1. When you run
out of positive numbers, you run right into the
largest negative numbers and then count back
down to 0.
• The whole idea here is putting a number that is
above the range of the variable can create
unpredictable problem.
Example: A demonstration of adding too large a
number to a signed integer.
#include <iostream.h>
int main() {
short int smallNumber;
smallNumber = 32767;
cout << "small number:" << smallNumber << endl;
smallNumber++;
cout << "small number:" << smallNumber << endl;
smallNumber++;
cout << "small number:" << smallNumber << endl;
return 0;
}
Output: small number:32767
small number:-32768
small number:-32767
IMPORTANT – To any variable, do not assign a value that
is beyond its range!
Cont.…
34. Characters
• Character variables (type char) are typically 1 byte, enough to hold 256
values.
• A char can be interpreted as a small number (0-255) or as a member of the
ASCII set.
• ASCII stands for the American Standard Code for Information Interchange.
• The ASCII character set and its ISO (International Standards Organization)
equivalent are a way to encode all the letters, numerals, and punctuation
marks.
• In the ASCII code, the lowercase letter "a" is assigned the value 97.
• All the lower- and uppercase letters, all the numerals, and all the
punctuation marks are assigned values between 1 and 128.
• Another 128 marks and symbols are reserved for use by the computer
maker, although the IBM extended character set has become something of a
standard.
Cont.…
35. Characters and Numbers
• When you put a character, for example, `a', into a char variable, what is really
there is just a number between 0 and 255.
• The compiler knows, however, how to translate back and forth between
characters (represented by a single quotation mark and then a letter, numeral, or
punctuation mark, followed by a closing single quotation mark) and one of the
ASCII values.
• The value/letter relationship is arbitrary; there is no particular reason that the
lowercase "a" is assigned the value 97.
• As long as everyone (your keyboard, compiler, and screen) agrees, there is no
problem.
• It is important to realize, however, that there is a big difference between the
value 5 and the character `5'.
• The latter is actually valued at 53, much as the letter `a' is valued at 97.
Cont.…
36. Operators
• C++ provides operators for composing arithmetic, relational, logical, bitwise, and
conditional expressions.
• It also provides operators which produce useful side-effects, such as assignment,
increment, and decrement.
Assignment Operators
• The assignment operator is used for storing a value at some memory location
(typically denoted by a variable).
• Its left operand should be an lvalue, and its right operand may be an arbitrary
expression.
• The latter is evaluated and the outcome is stored in the location denoted by the
lvalue.
• An lvalue (standing for left value) is anything that denotes a memory location in which
a value may be stored.
Cont.…
37. • The only kind of lvalue we have seen so far is a variable.
• Other kinds of lvalues (based on pointers and references) will be
described later.
• The assignment operator has a number of variants, obtained by
combining it with the arithmetic and bitwise operators.
Operator Example Equivalent To
= n = 25
+= n += 25 n = n + 25
-= n -= 25 n = n - 25
*= n *= 25 n = n * 25
/= n /= 25 n = n / 25
%= n %= 25 n = n % 25
&= n &= 0xF2F2 n = n & 0xF2F2
|= n |= 0xF2F2 n = n | 0xF2F2
^= n ^= 0xF2F2 n = n ^ 0xF2F2
<<= n <<= 4 n = n << 4
>>= n >>= 4 n = n >> 4
Cont.…
38. • An assignment operation is itself an expression whose value is the value
stored in its left operand.
• An assignment operation can therefore be used as the right operand of
another assignment operation.
• Any number of assignments can be concatenated in this fashion to form
one expression. For example:
int m, n, p;
m = n = p = 100; // means: n = (m = (p = 100));
m = (n = p = 100) + 2; // means: m = (n = (p = 100)) + 2;
• This is equally applicable to other forms of assignment. For example:
m = 100;
m += n = p = 10; // means: m = m + (n = p = 10);
Cont.…
39. Operator Name Example
+ Addition 12 + 4.9 // gives 16.9
- Subtraction 3.98 - 4 // gives -0.02
*
Multiplicatio
n 2 * 3.4 // gives 6.8
/ Division 9 / 2.0 // gives 4.5
% Remainder
13 % 3 //gives 1
// gives 1
Arithmetic operators.
• When both operands of the division operator (/)
are integers then the division is performed as an
integer division and not the normal division we
are used to.
• Integer division always results in an integer
outcome (i.e., the result is always rounded down).
For example: 9 / 2 // gives 4, not 4.5!
-9 / 2 // gives-5,not -4!
Arithmetic Operators
• C++ provides five basic arithmetic operators.
• Except for remainder (%) all other arithmetic operators can accept a mix of integer and
real operands.
• Generally, if both operands are integers then the result will be an integer.
• However, if one or both of the operands are reals then the result will be a real (or double
to be exact).
Cont.…
40. • Unintended integer divisions are a common source of programming
errors.
• To obtain a real division when both operands are integers, you should
cast one of the operands to be real:
int cost = 100;
int volume = 80;
double unitPrice = cost / (double) volume; // gives 1.25
• The remainder operator (%) expects integers for both of its operands.
• It returns the remainder of integer-dividing the operands.
• For example 13%3 is calculated by integer dividing 13 by 3 to give an
outcome of 4 and a remainder of 1; the result is therefore 1.
Cont.…
41. • It is possible for the outcome of an arithmetic operation to be too large for
storing in a designated variable. This situation is called an overflow.
• The outcome of an overflow is machine-dependent and therefore undefined. For
example:
• unsigned char k = 10 * 92; // overflow: 920 > 255
• It is illegal to divide a number by zero.
• This results in a run-time division-by-zero failure, which typically causes the
program to terminate.
• There are also a number of predefined library functions, which perform
arithmetic operations.
• As with input & output statements, if you want to use these you must put a
#include statement at the start of your program.
• Some of the more common library functions are summarised below.
Cont.…
42. Header File Function
Parameter
Type(s)
Result
Type Result
<stdlib.h> abs(i) int int Absolute value of i
<math.h> cos(x) float float Cosine of x (x is in radians)
<math.h> fabs(x) float float Absolute value of x
<math.h> pow(x, y) float float x raised to the power of y
<math.h> sin(x) float float Sine of x (x is in radians)
<math.h> sqrt(x) float float Square root of x
<math.h> tan(x) float float Tangent of x
Cont.…
Relational Operators
• C++ provides six relational operators
for comparing numeric quantities.
• Relational operators evaluate to 1
(representing the true outcome) or 0
(representing the false outcome).
Operator Name Example
== Equality 5 == 5 // gives 1
!= Inequality 5 != 5 // gives 0
< Less Than 5 < 5.5 // gives 1
<= Less Than or Equal 5 <= 5 // gives 1
> Greater Than 5 > 5.5 // gives 0
>=
Greater Than or
Equal 6.3 >= 5 // gives 1
Relational operators
43. • Note that the <= and >= operators are only supported in the form shown.
• In particular, =< and => are both invalid and do not mean anything.
• The operands of a relational operator must evaluate to a number.
• Characters are valid operands since they are represented by numeric values.
• For example (assuming ASCII coding):
• 'A' < 'F' // gives 1 (is like 65 < 70)
• The relational operators should not be used for comparing strings, because this will
result in the string addresses being compared, not the string contents.
• For example, the expression "HELLO" < "BYE" causes the address of "HELLO" to be
compared to the address of "BYE".
• As these addresses are determined by the compiler (in a machine-dependent manner),
the outcome may be 0 or 1, and is therefore undefined.
• C++ provides library functions (e.g., strcmp) for the lexicographic comparison of string.
Cont.…
44. Operator Name Example
! Logical Negation !(5 == 5) // gives 0
&& Logical And 5 < 6 && 6 < 6 // gives 1
|| Logical Or 5 < 6 || 6 < 5 // gives 1
Logical operators
Cont.…
Logical Operators
• C++ provides three logical operators for combining logical expression.
• Like the relational operators, logical operators evaluate to 1 or 0.
• Logical negation is a unary operator, which negates the logical value of its single
operand. If its operand is nonzero it produces 0, and if it is 0 it produces 1.
• Logical and produces 0 if one or both of its operands evaluate to 0. Otherwise, it
produces 1.
• Logical or produces 0 if both of its operands evaluate to 0. Otherwise, it
produces 1.
45. • Note that here we talk of zero and nonzero operands (not zero and 1).
• In general, any nonzero value can be used to represent the logical
true, whereas only zero represents the logical false.
• The following are, therefore, all valid logical expressions:
!20 // gives 0
10 && 5 // gives 1
10 || 5.5 // gives 1
10 && 0 // gives 0
Cont.…
• C++ does not have a built-in boolean type.
• It is customary to use the type int for this purpose instead. For example:
int sorted = 0; // false
int balanced = 1; // true
46. Operator Description Example
&
Binary AND Operator copies a bit to the result if it exists in both
operands. (A & B) will give 12 which is 0000 1100
| Binary OR Operator copies a bit if it exists in either operand. (A | B) will give 61 which is 0011 1101
^
Binary XOR Operator copies the bit if it is set in one operand but
not both. (A ^ B) will give 49 which is 0011 0001
~
Binary Ones Complement Operator is unary and has the effect of
'flipping' bits.
(~A ) will give -61 which is 1100 0011 in 2's
complement form due to a signed binary number.
<<
Binary Left Shift Operator. The left operands value is moved left by
the number of bits specified by the right operand. A << 2 will give 240 which is 1111 0000
>>
Binary Right Shift Operator. The left operands value is moved right
by the number of bits specified by the right operand. A >> 2 will give 15 which is 0000 1111
Bitwise Operators
C++ provides six bitwise operators for manipulating the individual bits in an integer quantity.
Cont.…
47. • Bitwise operators expect their operands to be integer quantities and
treat them as bit sequences.
• Bitwise negation is a unary operator which reverses the bits in its
operands.
• Bitwise and compares the corresponding bits of its operands and
produces a 1 when both bits are 1, and 0 otherwise.
• Bitwise or compares the corresponding bits of its operands and
produces a 0 when both bits are 0, and 1 otherwise.
• Bitwise exclusive or compares the corresponding bits of its operands
and produces a 0 when both bits are 1 or both bits are 0, and 1
otherwise.
Cont.…
48. • Bitwise left shift operator and bitwise right shift operator both take
a bit sequence as their left operand and a positive integer quantity n
as their right operand.
• The former produces a bit sequence equal to the left operand but
which has been shifted n bit positions to the left.
• The latter produces a bit sequence equal to the left operand but
which has been shifted n bit positions to the right. Vacated bits at
either end are set to 0.
Cont.…
49. Example Octal Value Bit Sequence
x 011 0 0 0 0 1 0 0 1
y 027 0 0 0 1 0 1 1 1
~x 366 1 1 1 1 0 1 1 0
x & y 001 0 0 0 0 0 0 0 1
x | y 037 0 0 0 1 1 1 1 1
x ^ y 036 0 0 0 1 1 1 1 0
x << 2 044 0 0 1 0 0 1 0 0
x >> 2 002 0 0 0 0 0 0 1 0
• To avoid worrying about the sign bit (which is machine dependent), it is common to
declare a bit sequence as an unsigned quantity:
unsigned char x = '011';
unsigned char y = '027';
• Table below illustrates how the bits are calculated.
Cont.…
• To calculate the bit sequence for the given values of
unsigned char, we need to understand the values in
both octal and binary notation.
Step-by-Step Conversion
1.Values in Octal:
•011 in octal
•027 in octal
2.Convert Octal to Decimal:
•011 (octal) = 1*8^1 + 1*8^0 = 8 + 1 = 9
(decimal)
•027 (octal) = 2*8^1 + 7*8^0 = 16 + 7 = 23
(decimal)
3.Convert Decimal to Binary:
•9 (decimal) = 00001001 (binary) (8-bit representation)
•23 (decimal) = 00010111 (binary) (8-bit
representation)
50. Operator Name Example
++ Auto Increment (prefix) ++k + 10 // gives 16
++ Auto Increment (postfix) k++ + 10 // gives 15
-- Auto Decrement (prefix) --k + 10 // gives 14
-- Auto Decrement (postfix) k-- + 10 // gives 15
Increment and decrement operators
• Both operators can be used in prefix and postfix form. The difference is significant.
• When used in prefix form, the operator is first applied and the outcome is then used in the
expression.
• When used in the postfix form, the expression is evaluated first and then the operator applied.
• Both operators may be applied to integer as well as real variables, although in practice real
Increment/decrement Operators
• The auto increment (++) and auto decrement (--) operators provide a convenient way of,
respectively, adding and subtracting 1 from a numeric variable.
• These are summarized in the following table. The examples assume the following
variable definition: int k = 5;
Cont.…
56. Precedence of Operators
The order in which operators are evaluated in an expression is
significant and is determined by precedence rules.
These rules divide the C++ operators into a number of precedence
levels.
Operators in higher levels take precedence over operators in lower
levels.
Cont.…
57. • For example, in a == b + c * d
• c * d is evaluated first because * has a higher precedence than + and ==.
• The result is then added to b because + has a higher precedence than ==,
and then == is evaluated.
• Precedence rules can be overridden using brackets. For example, rewriting
the above expression as a == (b + c) * d causes + to be evaluated before *.
• Operators with the same precedence level are evaluated in the order
specified by the last column of Table 2.7.
• For example, in a = b += c the evaluation order is right to left, so first b +=
c is evaluated, followed by a = b.
Cont.…
58. Level Operator Kind Order
Highest :: Unary Both
() [] -> . Binary Left to Right
+
-
++
--
!
~
*
&
new
delete sizeof() Unary Right to Left
->* .* Binary Left to Right
* / % Binary Left to Right
+ - Binary Left to Right
<< >> Binary Left to Right
< <= > >= Binary Left to Right
== != Binary Left to Right
& Binary Left to Right
^ Binary Left to Right
| Binary Left to Right
&& Binary Left to Right
|| Binary Left to Right
? : Ternary Left to Right
= +=
-=
*=
/=
^=
%=
&=
|=
<<=
>>= Binary Right to Left
Lowest , Binary Left to Right
59. #include <iostream>
using namespace std;
int main() {
// evaluates 17 * 6 first
int num1 = 5 - 17 * 6;
// equivalent expression to num1
int num2 = 5 - (17 * 6);
// forcing compiler to evaluate 5 - 17 first
int num3 = (5 - 17) * 6;
cout << "num1 = " << num1 << endl;
cout << "num2 = " << num2 << endl;
cout << "num3 = " << num3 << endl;
return 0;
}
Cont.…
60. • C++ Type Conversion
• C++ allows us to convert data of one type to that of another. This is known
as type conversion.
• There are two types of type conversion in C++:
• Implicit Conversion
• Explicit Conversion (also known as Type Casting)
Implicit Type Conversion
• The type conversion that is automatically done by the compiler is known as
implicit type conversion. This type of conversion is also known as automatic
conversion.
Cont.…
61. Simple Type Conversion
• A value in any of the built-in types we have see so far can be converted (type-
cast) to any of the other types. For example:
(int) 3.14 // converts 3.14 to an int to give 3
(long) 3.14 // converts 3.14 to a long to give 3L
(double) 2 // converts 2 to a double to give 2.0
(char) 122 // converts 122 to a char whose code is 122
(unsigned short) 3.14 // gives 3 as an unsigned short
• As shown by these examples, the built-in type identifiers can be used as type
operators. Type operators are unary (i.e., take one operand) and appear inside
brackets to the left of their operand. This is called explicit type conversion.
• When the type name is just one word, an alternate notation may be used in
which the brackets appear around the operand:
int(3.14) // same as: (int) 3.14
Cont.…
62. • In some cases, C++ also performs implicit type conversion. This happens
when values of different types are mixed in an expression. For example:
double d = 1; // d receives 1.0
Int i = 10.5; // i receives 10
i = i + d; // means: i = int(double(i) + d)
• In the last example, i + d involves mismatching types, so i is first converted
to double (promoted) and then added to d.
• The result is a double which does not match the type of i on the left side of
the assignment, so it is converted to int (demoted) before being assigned to
i.
• The above rules represent some simple but common cases for type
conversion.
Cont.…
63. //Type Casting
#include <iostream>
using namespace std;
int main()
{
// initializing a double variable
double num_double = 3.56;
cout << "num_double = " << num_double << endl;
// C-style conversion from double to int
int num_int1 = (int)num_double;
cout << "num_int1 = " << num_int1 << endl;
// function-style conversion from double to int
int num_int2 = int(num_double);
cout << "num_int2 = " << num_int2 << endl;
return 0;
Cont.…
64. // Working of implicit type-conversion
#include <iostream>
using namespace std;
int main() {
// assigning an int value to num_int
int num_int = 9;
// declaring a double type variable
double num_double;
// implicit conversion // assigning int value to a double variable
num_double = num_int;
cout << "num_int = " << num_int << endl;
cout << "num_double = " << num_double << endl;
return 0;
}
Cont.…
65. #include <iostream>
using namespace std;
int main()
{
int num_int;
double num_double = 9.99;
// implicit conversion
// assigning a double value to an int variable
num_int = num_double;
cout << "num_int = " << num_int << endl;
cout << "num_double = " << num_double << endl;
return 0;
}
Cont.…
66. • Statements represent the lowest-level building blocks of a program.
• Roughly speaking, each statement represents a computational step which has a
certain side-effect.
• (A side-effect can be thought of as a change in the program state, such as the value of
a variable changing because of an assignment.)
• Statements are useful because of the side-effects they cause, the combination of
which enables the program to serve a specific purpose (e.g., sort a list of names).
• A running program spends all of its time executing statements.
• The order in which statements are executed is called flow control (or control flow). This
term reflect the fact that the currently executing statement has the control of the CPU,
which when completed will be handed over (flow) to another statement.
• Flow control in a program is typically sequential, from one statement to the next, but
may be diverted to other paths by branch statements.
• Flow control is an important consideration because it determines what is executed
during a run and what is not, therefore affecting the overall outcome of the program.
Statements
67. • Like many other procedural languages, C++ provides different forms of
statements for different purposes.
• Declaration statements are used for defining variables.
• Assignment-like statements are used for simple, algebraic computations.
• Branching statements are used for specifying alternate paths of execution,
depending on the outcome of a logical condition.
• Loop statements are used for specifying computations which need to be
repeated until a certain logical condition is satisfied.
• Flow control statements are used to divert the execution path to another
part of the program.
Cont.…
68. Input/Output Statements
• The most common way in which a program communicates with the outside
world is through simple, character-oriented Input/Output (IO) operations.
• C++ provides two useful operators for this purpose: >> for input and << for
output.
Example
#include <iostream.h>
int main (void){ int workDays = 5;
float workHours = 7.5;
float payRate, weeklyPay;
cout << "What is the hourly pay rate? ";
cin >> payRate;
weeklyPay = workDays * workHours * payRate;
cout << "Weekly Pay = ";
cout << weeklyPay;
cout << 'n';}
Cont.…
69. Analysis
• This line outputs the prompt ‘What is the hourly pay rate? ’ to seek user
input.
• This line reads the input value typed by the user and copies it to payRate.
• The input operator >> takes an input stream as its left operand (cin is the
standard C++ input stream which corresponds to data entered via the
keyboard) and a variable (to which the input data is copied) as its right
operand.
• When run, the program will produce the following output (user input
appears in bold):
• What is the hourly pay rate? 33.55
• Weekly Pay = 1258.125
Cont.…
70. • Both << and >> return their left operand as their result, enabling multiple
input or multiple output operations to be combined into one statement.
• This is illustrated by example below which now allows the input of both
the daily work hours and the hourly pay rate.
Example
#include <iostream.h>
int main (void)
{
Int workDays = 5;
float workHours, payRate, weeklyPay;
cout << "What are the work hours and the hourly pay rate? ";
cin >> workHours >> payRate;
weeklyPay = workDays * workHours * payRate;
cout << "Weekly Pay = " << weeklyPay << 'n';
}
Cont.…
71. Analysis
• This line reads two input values typed by the user and copies them to workHours and payRate, respectively.
• The two values should be separated by white space (i.e., one or more space or tab characters).
• This statement is equivalent to: (cin >> workHours) >> payRate;
• Because the result of >> is its left operand, (cin >> workHours) evaluates to cin which is then used as the left
operand of the next >> operator.
• This line is the result of combining lines 10-12 from example 2.1.
• It outputs "Weekly Pay = ", followed by the value of weeklyPay, followed by a newline character. This
statement is equivalent to: ((cout << "Weekly Pay = ") << weeklyPay) << 'n';
• Because the result of << is its left operand, (cout << "Weekly Pay = ") evaluates to cout which is then used as
the left operand of the next << operator, etc.
• When run, the program will produce the following output:
• What are the work hours and the hourly pay rate? 7.5 33.55
• Weekly Pay = 1258.125
Cont.…
72. Null statement
Syntax:
;
Description: Do nothing
The block statement
Syntax:
{
[<Declarations>].
<List of statements/statement block>.
}
• Any place you can put a single statement, you can put a compound statement, also called a block.
• A block begins with an opening brace ({) and ends with a closing brace (}).
• Although every statement in the block must end with a semicolon, the block itself does not end with a semicolon. For
example
{
temp = a;
a = b;
b = temp;
}
• This block of code acts as one statement and swaps the values in the variables a and b.
Cont.…
73. #include <iostream>
using namespace std;
int main() {
int a = 5, b = 10, temp;
cout << "Before swapping." << endl;
cout << "a = " << a << ", b = " << b << endl;
temp = a;
a = b;
b = temp;
cout << "nAfter swapping." << endl;
cout << "a = " << a << ", b = " << b << endl;
return 0;
}
Cont.…
74. The Assignment statement
Syntax:
<Variable Identifier> = < expression>;
• Description:
• The <expression> is evaluated and the resulting value is stored in the
memory space reserved for <variable identifier>.
Eg: - int x,y ;
x=5;
y=x+3;
x=y*y;
Cont.…