The aim of this list of programming languages is to include all notable programming languages in existence, both those in current use and ... Note: This page does not list esoteric programming languages. .... Computer programming portal ...
C++ is an object-oriented programming language that was created as an extension of C programming language. It was created by Bjarne Stroustrup in 1979 at Bell Labs. Some key differences between C and C++ include C++ supporting object-oriented programming concepts like classes, inheritance and polymorphism, while C is a procedural language. Pointers and references are commonly used in C++ to pass arguments to functions by reference rather than by value. Arrays and functions are also important elements of C++ programs.
The document provides an introduction to C++ programming. It outlines key learning outcomes which include data types, input/output operators, control statements, arrays, functions, structures, and object-oriented programming concepts. It then discusses some of these concepts in more detail, including an overview of C++, its characteristics as both a high-level and low-level language, object-oriented programming principles, and basic data types.
C++ is an object-oriented programming language that is a superset of C and was created by Bjarne Stroustrup at Bell Labs in the early 1980s. C++ supports features like classes, inheritance, and object-oriented design while also being compatible with C. Some key characteristics of C++ include its support for object-oriented programming, portability, modular programming, and C compatibility. C++ programs are made up of tokens like identifiers, keywords, literals, punctuators, and operators.
C++ is most often used programming language. This slide will help you to gain more knowledge on C++ programming. In this slide you will learn the fundamentals of C++ programming. The slide will also help you to fetch more details on Object Oriented Programming concepts. Each of the concept under Object Oriented Programming is explained in detail and in more smoother way as it will helpful for everyone to understand.
Presentation on C++ Programming Languagesatvirsandhu9
This document provides an overview of the C++ programming language. It discusses why C++ is used, how it compares to Fortran, and the basic structure and components of a C++ program. The key topics covered include data types, variables, operators, selection statements, iteration statements, functions, arrays, pointers, input/output, preprocessor instructions, and comments. The document is intended to teach the basics of C++ programming in a structured way over multiple sections.
The document discusses rules of inference in logic. It begins by defining an argument as having premises and a conclusion. Several common rules of inference are then outlined, including modus ponens, modus tollens, and disjunctive syllogism. The remainder of the document works through examples of arguments and tests their validity using the rules of inference. It symbolically represents the arguments and shows the step-by-step workings to determine if the conclusions follow logically from the premises.
The document provides an introduction to data structures. It defines data structures as representations of logical relationships between data elements that consider both the elements and their relationships. It classifies data structures as either primitive or non-primitive. Primitive structures are directly operated on by machine instructions while non-primitive structures are built from primitive ones. Common non-primitive structures include stacks, queues, linked lists, trees and graphs. The document then discusses arrays as a data structure and operations on arrays like traversal, insertion, deletion, searching and sorting.
The document provides an overview of key concepts in C++, including:
1) C++ adds object-oriented programming capabilities to C while maintaining C's power and flexibility. It was created in 1979 to provide object-oriented programming features to C.
2) Object-oriented programming encourages breaking problems into constituent parts called objects that contain related instructions and data. The three main traits of OOP are encapsulation, polymorphism, and inheritance.
3) C++ supports both traditional and modern styles, with newer headers placed in the std namespace. Keywords like class, public, and virtual allow defining classes and controlling access to members. Functions can be overloaded if their signatures differ.
This document provides an overview of data types in C programming, including:
1) It describes four main types of data types - fundamental, modifiers, derived, and user defined. Fundamental types include integer, character, float, void. Modifiers change properties of other types. Derived types include arrays and pointers.
2) It explains the integer, float, character, and void fundamental data types in more detail. Integer can be short, int, long. Float and double store numbers in mantissa and exponent. Character represents keyboard characters.
3) Common C data type sizes and value ranges are provided for integer, float, and character types along with their modifiers like short, long, signed, unsigned.
The document discusses the different types of operators in C++, including unary, binary, ternary, arithmetic, logical, comparison, assignment, bitwise, and special operators like scope resolution (::), endl, and setw. It provides examples of how each operator is used, such as increment/decrement for unary, addition/subtraction for binary, conditional operator ?: for ternary, and manipulating bits with bitwise operators. The document also explains how scope resolution allows accessing global variables from inner blocks and how endl and setw are used for formatting output displays.
C++ provides built-in and user-defined data types. Built-in data types are pre-defined in C++ and include character, integer, floating point, double, void, and boolean. User-defined data types are composed of built-in types and include arrays, structures, unions, classes, and pointers. Data types determine the type of data that can be stored and the operations that can be performed on that data.
This document discusses the five main types of tokens in C++ - keywords, variables, constants, strings, and operators. It provides definitions and examples of each token type. Keywords are reserved words that cannot be used as variable names, while variables store values that can change. Constants represent fixed values, strings group characters within double quotes, and operators perform actions on operands like arithmetic, comparison, and assignment.
The document discusses various C++ data types including built-in, derived, and user-defined data types. It describes the different built-in data types like int, char, float, double, void and their properties. It also discusses derived data types like arrays, functions, pointers, references, and constant. The document further explains user-defined data types like structures, unions and classes/objects in C++.
This document provides an overview of constants, variables, and data types in the C programming language. It discusses the different categories of characters used in C, C tokens including keywords, identifiers, constants, strings, special symbols, and operators. It also covers rules for identifiers and variables, integer constants, real constants, single character constants, string constants, and backslash character constants. Finally, it describes the primary data types in C including integer, character, floating point, double, and void, as well as integer, floating point, and character types.
Functions allow programmers to break programs into smaller, reusable parts. There are two types of functions in C: library functions and user-defined functions. User-defined functions make programs easier to understand, debug, test and maintain. Functions are declared with a return type and can accept arguments. Functions can call other functions, allowing for modular and structured program design.
A pointer is a variable whose value is the address of another variable, i.e., direct address of the memory location. Like any variable or constant, you must declare a pointer before you can use it to store any variable address.
There are few important operations, which we will do with the help of pointers very frequently. (a) we define a pointer variable (b) assign the address of a variable to a pointer and (c) finally access the value at the address available in the pointer variable. This is done by using unary operator * that returns the value of the variable located at the address specified by its operand.
The document discusses various data types in C++ including built-in, user-defined, and derived types. Structures and unions allow grouping of dissimilar element types. Classes define custom data types that can then be used to create objects. Enumerated types attach numeric values to named constants. Arrays define a collection of elements of the same type in sequence. Functions contain blocks of code to perform tasks. Pointers store memory addresses.
This document discusses variables in C programming. It explains that variables are names that refer to memory locations where values can be stored and changed during program execution. It provides the syntax for declaring variables using different data types like int, float, double, and char. Rules for variable names are also outlined, such as starting with a letter or underscore and avoiding reserved words.
Operators and expressions in c languagetanmaymodi4
what is operator in c language
uses of operator in c language
syatax of operator in c language
program of operator in c language
what is expressions in c language
use of expressions in c language
syantax of expressions in c language
An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations.
C language supports a rich set of built-in operators. An operator is a symbol that tells the compiler to perform certain mathematical or logical manipulations. Operators are used in program to manipulate data and variables.
Here is a potential solution to the problem in C++:
#include <iostream>
using namespace std;
int main() {
int num1, num2, num3;
cout << "Enter three numbers: ";
cin >> num1 >> num2 >> num3;
int total = num1 + num2 + num3;
float average = total / 3.0;
cout << "The numbers entered were: " << num1 << ", " << num2 << ", " << num3 << endl;
cout << "Their average is: " << average;
return 0;
}
Some key points:
- Use cin to input the 3 numbers from the
The document discusses strings in C programming. It defines strings as sequences of characters stored as character arrays that are terminated with a null character. It covers string literals, declaring and initializing string variables, reading and writing strings, and common string manipulation functions like strlen(), strcpy(), strcmp(), and strcat(). These functions allow operations on strings like getting the length, copying strings, comparing strings, and concatenating strings.
Object oriented programming is a modular approach to programming that treats data and functions that operate on that data as objects. The basic elements of OOP are objects, classes, and inheritance. Objects contain both data and functions that operate on that data. Classes are templates that define common properties and relationships between objects. Inheritance allows new classes to acquire properties of existing classes. OOP provides advantages like modularity, code reuse, and data abstraction.
This document defines and provides examples of different types of operators in C programming. It discusses arithmetic, relational, logical, assignment, increment/decrement, conditional, bitwise, and special operators. For each type of operator it provides the syntax, example uses, and meaning. It also gives examples to illustrate the differences between prefix and postfix increment/decrement operators.
This PPT is for First year engineering student,It covered all about C Programming according to Rajastha Technical University Kota.
flowchart, pseudo code, Programming Languages and Language Translators, Identifiers, Constants, Variables, Basic Data Types, Operators, Expressions, type casting, Input / Output Statement, Scope Rules and Storage classes, Preprocessor and Macro Substitution.
C++ is a general-purpose programming language. It has imperative, object-oriented and generic programming features, while also providing the facilities for low-level memory manipulation.
It is designed with a bias toward system programming (e.g., for use in embedded systems or operating system kernels), with performance, efficiency and flexibility of use as its design requirements. C++ has also been found useful in many other contexts, including desktop applications, servers (e.g. e-commerce, web search or SQL servers), performance-critical applications (e.g. telephone switches or space probes), and entertainment software. C++ is a compiled language, with implementations of it available on many platforms and provided by various organizations, including the FSF, LLVM, Microsoft and Intel.
The document discusses C++ as a programming language. It was developed by Bjarne Stroustrup starting in 1979 at Bell Labs as an enhancement to the C programming language. Many major software and applications are written in C++, including Google Chrome, Mozilla Firefox, MySQL, Autodesk Maya 3D software, and parts of Apple's OS X and Microsoft Windows operating systems. The document also provides quotes from programmers about C++, both positive and negative. It notes that C++ is one of the most popular and widely used programming languages due to its use in systems software, applications, device drivers, embedded software, servers, clients, and games.
This document provides an overview of data types in C programming, including:
1) It describes four main types of data types - fundamental, modifiers, derived, and user defined. Fundamental types include integer, character, float, void. Modifiers change properties of other types. Derived types include arrays and pointers.
2) It explains the integer, float, character, and void fundamental data types in more detail. Integer can be short, int, long. Float and double store numbers in mantissa and exponent. Character represents keyboard characters.
3) Common C data type sizes and value ranges are provided for integer, float, and character types along with their modifiers like short, long, signed, unsigned.
The document discusses the different types of operators in C++, including unary, binary, ternary, arithmetic, logical, comparison, assignment, bitwise, and special operators like scope resolution (::), endl, and setw. It provides examples of how each operator is used, such as increment/decrement for unary, addition/subtraction for binary, conditional operator ?: for ternary, and manipulating bits with bitwise operators. The document also explains how scope resolution allows accessing global variables from inner blocks and how endl and setw are used for formatting output displays.
C++ provides built-in and user-defined data types. Built-in data types are pre-defined in C++ and include character, integer, floating point, double, void, and boolean. User-defined data types are composed of built-in types and include arrays, structures, unions, classes, and pointers. Data types determine the type of data that can be stored and the operations that can be performed on that data.
This document discusses the five main types of tokens in C++ - keywords, variables, constants, strings, and operators. It provides definitions and examples of each token type. Keywords are reserved words that cannot be used as variable names, while variables store values that can change. Constants represent fixed values, strings group characters within double quotes, and operators perform actions on operands like arithmetic, comparison, and assignment.
The document discusses various C++ data types including built-in, derived, and user-defined data types. It describes the different built-in data types like int, char, float, double, void and their properties. It also discusses derived data types like arrays, functions, pointers, references, and constant. The document further explains user-defined data types like structures, unions and classes/objects in C++.
This document provides an overview of constants, variables, and data types in the C programming language. It discusses the different categories of characters used in C, C tokens including keywords, identifiers, constants, strings, special symbols, and operators. It also covers rules for identifiers and variables, integer constants, real constants, single character constants, string constants, and backslash character constants. Finally, it describes the primary data types in C including integer, character, floating point, double, and void, as well as integer, floating point, and character types.
Functions allow programmers to break programs into smaller, reusable parts. There are two types of functions in C: library functions and user-defined functions. User-defined functions make programs easier to understand, debug, test and maintain. Functions are declared with a return type and can accept arguments. Functions can call other functions, allowing for modular and structured program design.
A pointer is a variable whose value is the address of another variable, i.e., direct address of the memory location. Like any variable or constant, you must declare a pointer before you can use it to store any variable address.
There are few important operations, which we will do with the help of pointers very frequently. (a) we define a pointer variable (b) assign the address of a variable to a pointer and (c) finally access the value at the address available in the pointer variable. This is done by using unary operator * that returns the value of the variable located at the address specified by its operand.
The document discusses various data types in C++ including built-in, user-defined, and derived types. Structures and unions allow grouping of dissimilar element types. Classes define custom data types that can then be used to create objects. Enumerated types attach numeric values to named constants. Arrays define a collection of elements of the same type in sequence. Functions contain blocks of code to perform tasks. Pointers store memory addresses.
This document discusses variables in C programming. It explains that variables are names that refer to memory locations where values can be stored and changed during program execution. It provides the syntax for declaring variables using different data types like int, float, double, and char. Rules for variable names are also outlined, such as starting with a letter or underscore and avoiding reserved words.
Operators and expressions in c languagetanmaymodi4
what is operator in c language
uses of operator in c language
syatax of operator in c language
program of operator in c language
what is expressions in c language
use of expressions in c language
syantax of expressions in c language
An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations.
C language supports a rich set of built-in operators. An operator is a symbol that tells the compiler to perform certain mathematical or logical manipulations. Operators are used in program to manipulate data and variables.
Here is a potential solution to the problem in C++:
#include <iostream>
using namespace std;
int main() {
int num1, num2, num3;
cout << "Enter three numbers: ";
cin >> num1 >> num2 >> num3;
int total = num1 + num2 + num3;
float average = total / 3.0;
cout << "The numbers entered were: " << num1 << ", " << num2 << ", " << num3 << endl;
cout << "Their average is: " << average;
return 0;
}
Some key points:
- Use cin to input the 3 numbers from the
The document discusses strings in C programming. It defines strings as sequences of characters stored as character arrays that are terminated with a null character. It covers string literals, declaring and initializing string variables, reading and writing strings, and common string manipulation functions like strlen(), strcpy(), strcmp(), and strcat(). These functions allow operations on strings like getting the length, copying strings, comparing strings, and concatenating strings.
Object oriented programming is a modular approach to programming that treats data and functions that operate on that data as objects. The basic elements of OOP are objects, classes, and inheritance. Objects contain both data and functions that operate on that data. Classes are templates that define common properties and relationships between objects. Inheritance allows new classes to acquire properties of existing classes. OOP provides advantages like modularity, code reuse, and data abstraction.
This document defines and provides examples of different types of operators in C programming. It discusses arithmetic, relational, logical, assignment, increment/decrement, conditional, bitwise, and special operators. For each type of operator it provides the syntax, example uses, and meaning. It also gives examples to illustrate the differences between prefix and postfix increment/decrement operators.
This PPT is for First year engineering student,It covered all about C Programming according to Rajastha Technical University Kota.
flowchart, pseudo code, Programming Languages and Language Translators, Identifiers, Constants, Variables, Basic Data Types, Operators, Expressions, type casting, Input / Output Statement, Scope Rules and Storage classes, Preprocessor and Macro Substitution.
C++ is a general-purpose programming language. It has imperative, object-oriented and generic programming features, while also providing the facilities for low-level memory manipulation.
It is designed with a bias toward system programming (e.g., for use in embedded systems or operating system kernels), with performance, efficiency and flexibility of use as its design requirements. C++ has also been found useful in many other contexts, including desktop applications, servers (e.g. e-commerce, web search or SQL servers), performance-critical applications (e.g. telephone switches or space probes), and entertainment software. C++ is a compiled language, with implementations of it available on many platforms and provided by various organizations, including the FSF, LLVM, Microsoft and Intel.
The document discusses C++ as a programming language. It was developed by Bjarne Stroustrup starting in 1979 at Bell Labs as an enhancement to the C programming language. Many major software and applications are written in C++, including Google Chrome, Mozilla Firefox, MySQL, Autodesk Maya 3D software, and parts of Apple's OS X and Microsoft Windows operating systems. The document also provides quotes from programmers about C++, both positive and negative. It notes that C++ is one of the most popular and widely used programming languages due to its use in systems software, applications, device drivers, embedded software, servers, clients, and games.
The document discusses the history and development of C++ from its origins in 1979 to the present day C++11 standard. It covers key milestones like standardization in 1998 and 2003 and the addition of features from TR1 and Boost. The C++11 standard focused on improving performance, usability, safety and learnability while maintaining backwards compatibility. New features included move semantics to optimize copying, constant expressions, and standard library enhancements.
This slide notes are more than 10 years old of my teacher Mr Karim Zebari. He uses a brilliant simple language to explain programming principles step by step.
This document provides an overview of topics covered in a C++ programming course, including:
- Introduction to C++ language fundamentals like data types, variables, operators, control structures, functions, and classes
- Memory concepts, arithmetic, decision making, and algorithms
- Structured and object-oriented programming principles
- The basics of the C++ environment like compilers, linkers, and input/output streams
- Common library functions and concepts like headers, prototypes, and enumerations
The document serves as an introductory reference for anyone learning C++ or wanting to understand the basic building blocks of the language.
Srinivasa Ramanujan was a renowned Indian mathematician who made extraordinary contributions to mathematical analysis, number theory, infinite series, and continued fractions despite having little formal training in pure mathematics. He displayed remarkable talent and intuition for mathematical theories from a young age. Although he struggled with poverty and lack of education, Ramanujan's work attracted the attention of mathematician G.H. Hardy, who helped bring Ramanujan to Cambridge University. There, Ramanujan continued his groundbreaking mathematical research until his untimely death at age 32 from illness. His notebooks contained thousands of results that have inspired continued research by mathematicians seeking to understand his insights and theorems.
This Edureka Python Programming tutorial will help you learn python and understand the various basics of Python programming with examples in detail. Below are the topics covered in this tutorial:
1. Python Installation
2. Python Variables
3. Data types in Python
4. Operators in Python
5. Conditional Statements
6. Loops in Python
7. Functions in Python
8. Classes and Objects
Srinivasa Ramanujan was a renowned Indian mathematician who made extraordinary contributions to mathematical analysis, number theory, infinite series, and continued fractions despite having no formal training in pure mathematics. He was born in 1887 in India and showed an extraordinary aptitude for mathematics from a young age. Ramanujan struggled to get recognition until he was introduced to the English mathematician G.H. Hardy through letters containing his original research. Hardy arranged for Ramanujan to work at Cambridge University where he spent the last years of his life conducting groundbreaking mathematical research before passing away in 1920 at the young age of 32. Ramanujan made substantial contributions to mathematical functions and analysis and continues to have a significant impact on mathematics despite his short life
Srinivasa Ramanujan was a renowned Indian mathematician who made extraordinary contributions to mathematical analysis, number theory, infinite series, and continued fractions despite having little formal training. He displayed remarkable talent and intuition for mathematical theories from a young age. Ramanujan received recognition after being invited to work with professor G.H. Hardy at Trinity College, Cambridge. Although he struggled with poor health in England, Ramanujan produced groundbreaking mathematical research and formulas before passing away at a young age in 1920. He is regarded as one of the greatest mathematicians and his contributions continue to have an impact.
1. The document provides 15 engineering details for waterproofing structural elements using bentonite-based waterproofing systems.
2. The details show applications of CEMtobent bentonite membranes and Quellmax bentonite waterstops at joints for floor slabs, walls, foundations, pile caps, and other structures.
3. Proper installation techniques are emphasized, including adequate overlaps, protection layers, minimum concrete covers, and compaction for backfill.
Blake Lapthorn Construction green breakfast - 5th Studio presentation - 20 Ma...Blake Morgan
On Wednesday 20 March, Blake Lapthorn's Construction law team were joined at the Construction green breakfast by Oliver Smith of 5th Studio. Oliver's talk was titled 'the challenges and rewards of making our built heritage sustainable – lessons from Trinity College Cambridge'.
Charles Babbage was a 19th century English mathematician and inventor. He conceived of the analytical engine, one of the first general purpose computers. The analytical engine used principles of modern computers like stored programs, conditional branching, and loops. It was never fully completed due to disputes, but influenced later computer pioneers like Ada Lovelace, John von Neumann, and Howard Aiken in establishing the foundations of modern general-purpose digital computers.
Este documento describe el programa de un congreso sobre contact centers y CRM que se llevará a cabo del 21 al 23 de abril de 2015 en Bogotá, Colombia. Incluye la lista de conferencistas, patrocinadores, talleres, y el programa detallado para los dos días del congreso, con charlas, paneles y conferencias sobre temas relacionados con la experiencia del cliente, tendencias en contact centers, innovación y estrategias de mercadeo.
This document discusses algorithms and programming. It begins by defining an algorithm as a finite set of steps to solve a problem. It provides examples of algorithms to find the average of test scores and divide two numbers. The document discusses characteristics of algorithms like inputs, outputs, definiteness, finiteness, and effectiveness. It also covers tools for designing algorithms like flowcharts and pseudocode. The document then discusses programming, explaining how to analyze a problem, design a solution, code it, test it, and evaluate it. It provides tips for writing clear, well-structured programs.
This document provides an introduction and overview for a course on programming in C++. It discusses the goals of the course, which are to teach programming principles and the C++ language. Students will learn essential concepts like variables, data types, functions, and arrays. They will write increasingly complex programs and develop good programming style. The course will be assessed through quizzes, exams, and class projects. Topics to be covered include variables, input/output, control flow, arrays, pointers, strings, and file I/O. Good programming practices like readability, simplicity, and avoiding reinventing solutions are emphasized.
This document provides an introduction to C++ for Java developers. It discusses the C++ standard and standard library, which includes containers, strings, input/output streams, and other functionality. It also covers installing compilers like GCC, compiling and running simple C++ programs, code style, using Makefiles, and includes examples of basic C++ syntax like output, input, datatypes, and strings.
Here are the key differences between LANs, MANs, and WANs:
- LANs cover small geographic areas like a home, office building or school. MANs connect buildings within a city or campus. WANs span large areas like cities, countries or globally.
- LANs are usually owned by a single organization. MANs connect multiple organizations. WANs have no single owner.
- LANs use distances less than 1 mile. MANs connect over distances up to 100 miles. WANs span distances greater than 100 miles.
- Examples include home networks, office networks for LANs. Campus networks for MANs. The internet is an example of a W
This document provides a wiring diagram for an anti-lock braking system (ABS) with vehicle stability control for a vehicle made by TMC. It includes a list of components, their connections and pinouts. Key components include ECUs, sensors for wheel speed, steering angle, yaw rate and other variables. The diagram shows the interconnections between these components and their related power and ground connections.
Bluetooth is a short-range wireless technology that allows data exchange between devices like phones, laptops, and printers. It was developed in 1994 and uses radio waves in the 2.4 GHz band to connect devices within a 10-100 meter range. Bluetooth devices can form ad-hoc networks called piconets to share data and voice signals. While convenient, Bluetooth has limitations like low data rates, short range, and potential security issues if not configured properly. It finds applications in wireless headsets, car infotainment systems, and wireless speakers. Future developments aim to improve bandwidth, reduce interference, and streamline connection setup while maintaining compatibility.
This document provides an overview of C++ programming and processing a C++ program. It discusses the evolution of programming languages and how a C++ program is compiled from source code to machine code. The document also explains that a C++ program is run by using an editor to create source code, preprocessing it, compiling it to create an object program, linking the object program, loading the executable code into memory, and executing it.
This document provides an overview of the key concepts covered in Chapter 2 of the C++ Programming textbook. These include basic C++ program components like functions, data types, arithmetic operators, and input/output statements. It also discusses programming fundamentals like declaring variables, writing comments, using preprocessor directives, and properly structuring a C++ program with a main function. An example is provided to demonstrate how to write a program that converts between feet/inches and centimeters.
The document provides an introduction to programming fundamentals in C++, including basic syntax and components of a C++ program. It covers variables and data types, input/output, comments, and how to write a simple C++ program with preprocessor directives and a main function. The key topics discussed are variable declaration, fundamental data types like int, float, char, comments, and how to write a basic "Hello World" program in C++.
Object oriented programming 8 basics of c++ programmingVaibhav Khanna
OOP was inventing to overcome the drawbacks of POP. It follows down -up approach.
• In OOP, problem is considered as a collection of objects and objects are instance of classes.
This chapter discusses the basic elements of C++ programs, including functions, data types, operators, and input/output statements. It covers fundamental concepts like declaring variables and constants, arithmetic expressions, strings, and comments. The objectives are to familiarize readers with C++ syntax and semantics, and teach them how to properly structure a basic C++ program.
Java is a computer programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies as possible.
The chapter introduces the basic components of a C++ program, including functions, data types, operators, and statements. It discusses simple data types like integers, characters, and floating-point numbers. The chapter also covers arithmetic operators, expressions, and the order of precedence. It explains variable declaration, assignment statements, and how to input and output data. The goal is for readers to understand the basic structure and syntax of a C++ program.
This document provides an introduction to programming with C++, including comments, data types, variables, arithmetic operators, and expressions. It discusses single-line and multi-line comments to document code. The fundamental C++ data types are integer, floating point, and character, each with different size ranges. Variables are declared with a data type and assigned values. Arithmetic operators allow mathematical expressions to be evaluated using precedence rules. Relational operators enable boolean expressions.
This document discusses basic program elements in C++, including:
1. Initializing variables can be done in two ways - by appending an equal sign followed by the value (int a = 0), or by enclosing the value in parentheses (int a(0)). Both methods are valid in C++.
2. Variables can have either local or global scope - local variables are declared within a function while global variables are declared outside all functions.
3. Keywords are reserved words in C++ that have special meaning and cannot be used as regular identifiers. Common keywords include int, float, if, else, while, etc.
#Code2Create series: C++ is a powerful general-purpose programming language. It can be used to develop operating systems, browsers, games, and so on. C++ supports different ways of programming like procedural, object-oriented, functional, and so on.Start your programming journey and join us to learn C++ basics!
by Google Developers Group and Women Tech-markers Kuwait chapter:
Instagram and Twitter: @GDGWTMKUWAIT
The document provides information on fundamental C data types including bits, bytes, words, integers, floating point numbers, enumerated types, variables, type conversions, constants, and basic operators. It defines common data types like char, int, float, and double. It also covers typecasting, variable declaration, and basic arithmetic, logical, relational, and bitwise operators.
This document provides an introduction to the C programming language. It discusses that C was developed in 1972 by Dennis Ritchie at Bell Labs to create the UNIX operating system. C is a structured, procedural programming language that is widely used to develop operating systems, databases, networks, and more. The document then covers some key concepts in C including functions, header files, variables, data types, operators, and escape sequences. It provides examples of basic C programs and exercises for practicing programming concepts.
This document discusses C++ programming and includes several sections:
- It provides an overview of how a C++ program is processed by a compiler and linker before being executed.
- It explains the problem analysis-coding-execution cycle used for programming and problem solving.
- It presents an example algorithm for calculating the perimeter and area of a rectangle.
- It outlines the basic elements and components of a C++ program such as functions, data types, operators, and comments.
Such devices make up the peripheral equipment of modern digital computer systems. An input device converts incoming data and instructions into a pattern of ...
IT & Technology
Computer Technology
Java is a computer programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies as possible.
This chapter discusses control structures in Java programs. It covers relational operators and logical expressions used for comparisons. Selection control structures like if, if-else, and switch statements are examined along with examples. The chapter also provides an example programming problem on cable company billing that demonstrates using control structures and nested conditional logic.
An overview of computers and programming languages Ahmad Idrees
This chapter discusses computers and programming languages. It explains that a computer system consists of hardware and software components. Programming languages allow users to communicate instructions to the computer, with compilers translating programs into machine language. The chapter then covers algorithms for problem solving, and structured and object-oriented programming methodologies. Key topics include how Java programs are processed, the evolution of programming languages, and the components of a computer system.
Introduction to objects and inputoutput Ahmad Idrees
Java is a computer programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies as possible.
Strategic planning and mission statement Ahmad Idrees
Strategic planning involves developing annual and long-term plans to achieve objectives amid changing market conditions. A mission statement communicates a company's purpose by describing its business, customers, and profit status. Marketing involves analyzing internal strengths along with external political, economic, social, technological, and competitive factors that comprise the macro and micro environment. The planning process entails situational analysis, objective-setting, strategy development, action planning, and control via feedback. Marketing audits examine performance to identify issues and recommend improvements. PEST analysis scans the political, economic, social, and technological landscape to understand external influences on an organization.
Marketing involves a range of processes concerned with finding out what consumers want, and then providing it for them. This involves four key elements, which are referred to as the 4Ps. A useful starting point therefore is to carry out market research to find out about customer requirements in relation to the 4Ps.
Marketing involves a range of processes concerned with finding out what consumers want, and then providing it for them. This involves four key elements, which are referred to as the 4Ps. A useful starting point therefore is to carry out market research to find out about customer requirements in relation to the 4Ps.
Marketing involves a range of processes concerned with finding out what consumers want, and then providing it for them. This involves four key elements, which are referred to as the 4Ps. A useful starting point therefore is to carry out market research to find out about customer requirements in relation to the 4Ps.
The document discusses principles of marketing and managing marketing information. It covers assessing marketing information needs, developing marketing information through internal data, marketing intelligence and marketing research. Marketing research involves defining problems, developing research plans, implementing plans, analyzing and reporting findings. It also discusses analyzing marketing information using tools like CRM, distributing information, and considerations around international research and ethics.
Marketing involves a range of processes concerned with finding out what consumers want, and then providing it for them. This involves four key elements, which are referred to as the 4Ps. A useful starting point therefore is to carry out market research to find out about customer requirements in relation to the 4Ps.
C++ programming program design including data structures Ahmad Idrees
The aim of this list of programming languages is to include all notable programming languages in existence, both those in current use and ... Note: This page does not list esoteric programming languages. .... Computer programming portal ...
Control structures in C++ Programming LanguageAhmad Idrees
This document discusses various control structures in C++ for selection and branching, including if/else statements, switch statements, logical operators, and the assert function. If/else statements allow for two-way selection based on a logical expression being true or false. Switch statements allow for multi-way branching depending on the value of an expression. Logical operators like && and || are used to combine logical expressions. The assert function halts a program if a specified condition is false, which is useful for debugging.
What is computer Introduction to Computing Ahmad Idrees
Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done.
Computers are useless. They can only give you answers.
Most of the important things in the world have been accomplished by people who have kept on trying when there seemed to be no hope at all.
There are no secrets to success. It is the result of preparation, hard work, and learning from failure.
Easy reading is damn hard writing. But if it's right, it's easy. It's the other way round, too. If it's slovenly written, then it's hard to read. It doesn't give the reader what the careful writer can give the reader.
Most of the important things in the world have been accomplished by people who have kept on trying when there seemed to be no hope at all.
There are no secrets to success. It is the result of preparation, hard work, and learning from failure.
Most of the important things in the world have been accomplished by people who have kept on trying when there seemed to be no hope at all.
There are no secrets to success. It is the result of preparation, hard work, and learning from failure.
Top 40 seo myths everyone should know aboutAhmad Idrees
The road to SEO success is very broad and complex. Ranking on first page is not heaven sent. I’ve seen a lot of never-ending debates about SEO and internet marketing from leading forum sites.
Having said that, it’s very important for us to take the advice of experts in the field. Simply because they’ve been there and they’ve done that. They can help us understand SEO and internet marketing better and lead us straight ahead.
Maximizing Business Value with AWS Consulting Services.pdfElena Mia
An overview of how AWS consulting services empower organizations to optimize cloud adoption, enhance security, and drive innovation. Read More: https://www.damcogroup.com/aws-cloud-services/aws-consulting.
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.
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.
FME for Climate Data: Turning Big Data into Actionable InsightsSafe Software
Regional and local governments aim to provide essential services for stormwater management systems. However, rapid urbanization and the increasing impacts of climate change are putting growing pressure on these governments to identify stormwater needs and develop effective plans. To address these challenges, GHD developed an FME solution to process over 20 years of rainfall data from rain gauges and USGS radar datasets. This solution extracts, organizes, and analyzes Next Generation Weather Radar (NEXRAD) big data, validates it with other data sources, and produces Intensity Duration Frequency (IDF) curves and future climate projections tailored to local needs. This presentation will showcase how FME can be leveraged to manage big data and prioritize infrastructure investments.
The Future of Open Source Reporting Best Alternatives to Jaspersoft.pdfVarsha Nayak
In recent years, organizations have increasingly sought robust open source alternative to Jasper Reports as the landscape of open-source reporting tools rapidly evolves. While Jaspersoft has been a longstanding choice for generating complex business intelligence and analytics reports, factors such as licensing changes and growing demands for flexibility have prompted many businesses to explore other options. Among the most notable alternatives to Jaspersoft, Helical Insight stands out for its powerful open-source architecture, intuitive analytics, and dynamic dashboard capabilities. Designed to be both flexible and budget-friendly, Helical Insight empowers users with advanced features—such as in-memory reporting, extensive data source integration, and customizable visualizations—making it an ideal solution for organizations seeking a modern, scalable reporting platform. This article explores the future of open-source reporting and highlights why Helical Insight and other emerging tools are redefining the standards for business intelligence solutions.
Automating Map Production With FME and PythonSafe Software
People still love a good paper map, but every time a request lands on a GIS team’s desk, it takes time to create that perfect, individual map—even when you're ready and have projects prepped. Then come the inevitable changes and iterations that add even more time to the process. This presentation explores a solution for automating map production using FME and Python. FME handles the setup of variables, leveraging GIS reference layers and parameters to manage details like map orientation, label sizes, and layout elements. Python takes over to export PDF maps for each location and template size, uploading them monthly to ArcGIS Online. The result? Fresh, regularly updated maps, ready for anyone to grab anytime—saving you time, effort, and endless revisions while keeping users happy with up-to-date, accessible maps.
NTRODUCTION TO SOFTWARE TESTING
• Definition:
• Software testing is the process of evaluating and
verifying that a software application or system meets
specified requirements and functions correctly.
• Purpose:
• Identify defects and bugs in the software.
• Ensure the software meets quality standards.
• Validate that the software performs as intended in
various scenarios.
• Importance:
• Reduces risks associated with software failures.
• Improves user satisfaction and trust in the product.
• Enhances the overall reliability and performance of
the software
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.
Best Inbound Call Tracking Software for Small BusinessesTheTelephony
The best inbound call tracking software for small businesses offers features like call recording, real-time analytics, lead attribution, and CRM integration. It helps track marketing campaign performance, improve customer service, and manage leads efficiently. Look for solutions with user-friendly dashboards, customizable reporting, and scalable pricing plans tailored for small teams. Choosing the right tool can significantly enhance communication and boost overall business growth.
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
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.
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.
Invited Talk at RAISE 2025: Requirements engineering for AI-powered SoftwarE Workshop co-located with ICSE, the IEEE/ACM International Conference on Software Engineering.
Abstract: Foundation Models (FMs) have shown remarkable capabilities in various natural language tasks. However, their ability to accurately capture stakeholder requirements remains a significant challenge for using FMs for software development. This paper introduces a novel approach that leverages an FM-powered multi-agent system called AlignMind to address this issue. By having a cognitive architecture that enhances FMs with Theory-of-Mind capabilities, our approach considers the mental states and perspectives of software makers. This allows our solution to iteratively clarify the beliefs, desires, and intentions of stakeholders, translating these into a set of refined requirements and a corresponding actionable natural language workflow in the often-overlooked requirements refinement phase of software engineering, which is crucial after initial elicitation. Through a multifaceted evaluation covering 150 diverse use cases, we demonstrate that our approach can accurately capture the intents and requirements of stakeholders, articulating them as both specifications and a step-by-step plan of action. Our findings suggest that the potential for significant improvements in the software development process justifies these investments. Our work lays the groundwork for future innovation in building intent-first development environments, where software makers can seamlessly collaborate with AIs to create software that truly meets their needs.
Bonk coin airdrop_ Everything You Need to Know.pdfHerond Labs
The Bonk airdrop, one of the largest in Solana’s history, distributed 50% of its total supply to community members, significantly boosting its popularity and Solana’s network activity. Below is everything you need to know about the Bonk coin airdrop, including its history, eligibility, how to claim tokens, risks, and current status.
https://blog.herond.org/bonk-coin-airdrop/
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.
Who will create the languages of the future?Jordi Cabot
Will future languages be created by language engineers?
Can you "vibe" a DSL?
In this talk, we will explore the changing landscape of language engineering and discuss how Artificial Intelligence and low-code/no-code techniques can play a role in this future by helping in the definition, use, execution, and testing of new languages. Even empowering non-tech users to create their own language infrastructure. Maybe without them even realizing.
14 Years of Developing nCine - An Open Source 2D Game FrameworkAngelo Theodorou
A 14-year journey developing nCine, an open-source 2D game framework.
This talk covers its origins, the challenges of staying motivated over the long term, and the hurdles of open-sourcing a personal project while working in the game industry.
Along the way, it’s packed with juicy technical pills to whet the appetite of the most curious developers.
2. Objectives
In this chapter, you will:
• Become familiar with the basic components of
a C++ program, including functions, special
symbols, and identifiers
• Explore simple data types
• Discover how to use arithmetic operators
• Examine how a program evaluates arithmetic
expressions
2
3. Objectives (continued)
• Learn what an assignment statement is and
what it does
• Become familiar with the string data type
• Discover how to input data into memory using
input statements
• Become familiar with the use of increment and
decrement operators
• Examine ways to output results using output
statements
3
4. Objectives (continued)
• Learn how to use preprocessor directives and
why they are necessary
• Explore how to properly structure a program,
including using comments to document a
program
• Learn how to write a C++ program
4
5. Structure of a C++ program
Source code
1. // my first program in C++
2. # include <iostream>
3.
4. int main ()
5. {
6. std::cout<<“Hello Word!”;
7. }
Output
Hello Word!
5
6. Components of a C++ program
• Line 1: // my first program in C++
• Lines beginning with two slash signs (//) are
comments by the programmer and have no
effect on the behavior of the program.
• Programmers use them to include short
explanations or observations concerning the
code or program. In this case, it is a brief
introductory description of the program.
6
7. Components of a C++ program (Cont.)
• Line 2: #include <iostream>
• Lines beginning with a hash sign (#) are
directives read and interpreted by what is
known as the preprocessor.
• In this case, the directive #include <iostream>,
instructs the preprocessor to include a section
of standard C++ code, known as header
iostream, that allows to perform standard input
and output operations.
7
8. • Line 3: A blank line.
• Blank lines have no effect on a program. They
simply improve readability.
8
Components of a C++ program (Cont.)
9. • Line 4: int main ( )
• This line initiates the declaration of a function.
Essentially, a function is a group of code
statements which are given a name: in this
case, this gives the name "main" to the group
of code statements that follow.
• The execution of all C++ programs begins with
the main function regardless of where the
function is actually located within the code.
9
Components of a C++ program (Cont.)
10. • Line 6: std::cout << "Hello World!";
• This statement has three parts: First, std::cout,
which identifies the standard character output
device (usually, this is the computer screen).
• Second, the insertion operator (<<), which
indicates that what follows is inserted
into std::cout.
• Finally, a sentence within quotes ("Hello
world!"), is the content inserted into the
standard output.
10
Components of a C++ program (Cont.)
11. The Basics of a C++ Program
• Function: collection of statements; when
executed, accomplishes something
− May be predefined or standard
• Syntax: rules that specify which statements
(instructions) are legal
• Programming language: a set of rules,
symbols, and special words
• Semantic rule: meaning of the instruction
11
12. Comments
• Comments are for the reader, not the compiler
• Two types:
− Single line
// This is a C++ program. It prints the sentence:
// Welcome to C++ Programming.
− Multiple line
/*
You can include comments that can
occupy several lines.
*/
12
14. Reserved Words (Keywords)
• Reserved words, keywords, or word symbols
− Include:
• int
• float
• double
• char
• const
• void
• return
14
15. Identifiers (Variable names)
• Consist of letters, digits, and the underscore
character ( _ )
• Must begin with a letter or underscore
• C++ is case sensitive
− NUMBER is not the same as number
• Two predefined identifiers are cout and cin
• Unlike reserved words, predefined identifiers
may be redefined, but it is not a good idea
15
17. Whitespaces
• Every C++ program contains whitespaces
− Include blanks, tabs, and newline characters
• Used to separate special symbols, reserved
words, and identifiers
• Proper utilization of whitespaces is important
− Can be used to make the program readable
17
18. Simple Data Types
Data Type Size in Memory Typical Range (values)
Unsigned integer (int) 4 – Bytes 0 to 4294967295 (~10 digits)
Signed integer 4 – Bytes -2147483648 to 2147483647
Floating point (float) 4 – Bytes +/- 3.4e +/- 38 (~7 digits)
Double (double) 8 – Bytes +/- 1.7e +/- 308 (~15 digits)
Character (char) 1 – Byte 0 to 255
Boolean (bool) 1 – Bytes True or false
18
Different compilers may allow different ranges of values
19. int Data Type
• Examples:
-6728
0
78
+763
• Positive integers do not need a + sign
• No commas are used within an integer
− Commas are used for separating items in a list
19
20. Floating-Point Data Types
− float: represents any real number
• Range: -3.4E+38 to 3.4E+38 (four bytes)
− double: represents any real number
• Range: -1.7E+308 to 1.7E+308 (eight bytes)
− On most newer compilers, data types double
and long double are same
20
21. Floating-Point Data Types
(continued)
• Maximum number of significant digits
(decimal places) for float values is 7
• Maximum number of significant digits for
double is 15
• Precision: maximum number of significant
digits
− Float values are called single precision
− Double values are called double precision
21
22. char Data Type
• The smallest integral data type
• Used for characters: letters, digits, and special
symbols
• Each character is enclosed in single quotes
− 'A', 'a', '0', '*', '+', '$', '&'
• A blank space is a character and is written ' ',
with a space left between the single quotes
22
23. bool Data Type
• bool type
− Two values: true and false
− Manipulate logical (Boolean) expressions
• true and false are called logical values
• bool, true, and false are reserved words
23
24. Arithmetic Operators and Operator
Precedence
• C++ arithmetic operators:
− + addition
− - subtraction
− * multiplication
− / division
− % modulus operator
• +, -, *, and / can be used with integral and
floating-point data types
• Operators can be unary or binary
24
25. Order of Precedence
• All operations inside of () are evaluated first
• *, /, and % are at the same level of
precedence and are evaluated next
• + and – have the same level of precedence
and are evaluated last
• When operators are on the same level
− Performed from left to right (associativity)
• 3 * 7 - 6 + 2 * 5 / 4 + 6 means
(((3 * 7) – 6) + ((2 * 5) / 4 )) + 6
25
26. Expressions
• If all operands are integers
− Expression is called an integral expression
• Yields an integral result
• Example: 2 + 3 * 5
• If all operands are floating-point
− Expression is called a floating-point
expression
• Yields a floating-point result
• Example: 12.8 * 17.5 - 34.50
26
27. Mixed Expressions
• Mixed expression:
− Has operands of different data types
− Contains integers and floating-point
• Examples of mixed expressions:
2 + 3.5
6 / 4 + 3.9
5.4 * 2 – 13.6 + 18 / 2
27
28. Mixed Expressions (continued)
• Evaluation rules:
− If operator has same types of operands
• Evaluated according to the type of the operands
− If operator has both types of operands
• Integer is changed to floating-point
• Operator is evaluated
• Result is floating-point
− Entire expression is evaluated according to
precedence rules
28
29. string Type
• Programmer-defined type supplied in
ANSI/ISO Standard C++ library
• Sequence of zero or more characters
• Enclosed in double quotation marks
• Null: a string with no characters
• Each character has relative position in string
− Position of first character is 0
• Length of a string is number of characters in it
− Example: length of "William Jacob" is 13
29
30. Input
• Data must be loaded into main memory
before it can be manipulated
• Storing data in memory is a two-step process:
− Instruct computer to allocate memory
− Include statements to put data into memory
30
31. Declaring & Initializing Variables
• Variables can be initialized when declared:
int first=13, second=10;
char ch=' ';
double x=12.6;
• All variables must be initialized before they
are used
− But not necessarily during declaration
31
32. Putting Data into Variables
• Ways to place data into a variable:
− Use C++’s assignment statement
− Use input (read) statements
32
33. Allocating Memory with Constants
and Variables
• Variable: memory location whose content
may change during execution
• The syntax to declare a named constant is:
33
34. Allocating Memory with Constants
and Variables (continued)
• Named constant: memory location whose
content can’t change during execution
• The syntax to declare a named constant is:
• In C++, const is a reserved word
34
35. Assignment Statement
• The assignment statement takes the form:
• Expression is evaluated and its value is
assigned to the variable on the left side
• In C++, = is called the assignment operator
35
37. Saving and Using the Value of an
Expression
• To save the value of an expression:
− Declare a variable of the appropriate data type
− Assign the value of the expression to the
variable that was declared
• Use the assignment statement
• Wherever the value of the expression is
needed, use the variable holding the value
37
38. Input (Read) Statement
• cin is used with >> to gather input
• The stream extraction operator is >>
• For example, if miles is a double variable
cin >> miles;
− Causes computer to get a value of type
double
− Places it in the variable miles
38
39. Input (Read) Statement (continued)
• Using more than one variable in cin allows
more than one value to be read at a time
• For example, if feet and inches are
variables of type int, a statement such as:
cin >> feet >> inches;
− Inputs two integers from the keyboard
− Places them in variables feet and inches
respectively
39
41. Variable Initialization
• There are two ways to initialize a variable:
int feet;
− By using the assignment statement
feet = 35;
− By using a read statement
cin >> feet;
41
42. Increment & Decrement Operators
• Increment operator: increment variable by 1
− Pre-increment: ++variable
− Post-increment: variable++
• Decrement operator: decrement variable by 1
− Pre-decrement: --variable
− Post-decrement: variable—
• What is the difference between the following?
42
x = 5;
y = ++x;
x = 5;
y = x++;
43. Output
• The syntax of cout and << is:
− Called an output statement
• The stream insertion operator is <<
• Expression evaluated and its value is printed
at the current cursor position on the screen
43
44. Output (continued)
• A manipulator is used to format the output
− Example: endl causes insertion point to move
to beginning of next line
44
45. Output (continued)
• The new line character is 'n'
− May appear anywhere in the string
cout << "Hello there.";
cout << "My name is James.";
• Output:
Hello there.My name is James.
cout << "Hello there.n";
cout << "My name is James.";
• Output :
Hello there.
My name is James.
45
47. Preprocessor Directives
• C++ has a small number of operations
• Many functions and symbols needed to run a
C++ program are provided as collection of
libraries
• Every library has a name and is referred to by a
header file
• Preprocessor directives are commands
supplied to the preprocessor
• All preprocessor commands begin with #
• No semicolon at the end of these commands
47
48. Preprocessor Directives
(continued)
• Syntax to include a header file:
• For example:
#include <iostream>
− Causes the preprocessor to include the
header file iostream in the program
48
49. namespace and Using cin and
cout in a Program
• cin and cout are declared in the header file
iostream, but within std namespace
• To use cin and cout in a program, use the
following two statements:
#include <iostream>
using namespace std;
49
50. Using the string Data Type in a
Program
• To use the string type, you need to access
its definition from the header file string
• Include the following preprocessor directive:
#include <string>
50
51. Creating a C++ Program
• C++ program has two parts:
− Preprocessor directives
− The program
• Preprocessor directives and program
statements constitute C++ source code (.cpp)
• Compiler generates object code (.obj)
• Executable code is produced and saved in a
file with the file extension .exe
51
52. Creating a C++ Program
(continued)
• A C++ program is a collection of functions,
one of which is the function main
• The first line of the function main is called the
heading of the function:
int main()
• The statements enclosed between the curly
braces ({ and }) form the body of the function
− Contains two types of statements:
• Declaration statements
• Executable statements
52
54. Creating a C++ Program
(continued)
Sample Run:
Line 9: firstNum = 18
Line 10: Enter an integer: 15
Line 13: secondNum = 15
Line 15: The new value of firstNum = 60
54
55. Program Style and Form
• Every C++ program has a function main
• It must also follow the syntax rules
• Other rules serve the purpose of giving
precise meaning to the language
55
56. Syntax
• Errors in syntax are found in compilation
int x; //Line 1
int y //Line 2: error
double z; //Line 3
y = w + x; //Line 4: error
56
57. Use of Blanks
• In C++, you use one or more blanks to
separate numbers when data is input
• Used to separate reserved words and
identifiers from each other and from other
symbols
• Must never appear within a reserved word or
identifier
57
58. Use of Semicolons, Brackets, and
Commas
• All C++ statements end with a semicolon
− Also called a statement terminator
• { and } are not C++ statements
• Commas separate items in a list
58
59. Semantics
• Possible to remove all syntax errors in a
program and still not have it run
• Even if it runs, it may still not do what you
meant it to do
• For example,
2 + 3 * 5 and (2 + 3) * 5
are both syntactically correct expressions, but
have different meanings
59
60. Naming Identifiers
• Identifiers can be self-documenting:
− CENTIMETERS_PER_INCH
• Avoid run-together words :
− annualsale
− Solution:
• Capitalize the beginning of each new word
• annualSale
• Inserting an underscore just before a new word
• annual_sale
60
61. Prompt Lines
• Prompt lines: executable statements that
inform the user what to do
cout << "Please enter a number between 1 and 10 and "
<< "press the return key" << endl;
cin >> num;
61
62. Documentation
• A well-documented program is easier to
understand and modify
• You use comments to document programs
• Comments should appear in a program to:
− Explain the purpose of the program
− Identify who wrote it
− Explain the purpose of particular statements
62
63. Form and Style
• Consider two ways of declaring variables:
− Method 1
int feet, inch;
double x, y;
− Method 2
int a,b;double x,y;
• Both are correct; however, the second is hard
to read
63
64. More on Assignment Statements
• C++ has special assignment statements
called compound assignments
+=, -=, *=, /=, and %=
• Example:
x *= y;
64
65. Programming Example:
Convert Length
• Write a program that takes as input a given
length expressed in feet and inches
− Convert and output the length in centimeters
• Input: length in feet and inches
• Output: equivalent length in centimeters
• Lengths are given in feet and inches
• Program computes the equivalent length in
centimeters
• One inch is equal to 2.54 centimeters
65
66. Programming Example: Convert
Length (continued)
• Convert the length in feet and inches to all
inches:
− Multiply the number of feet by 12
− Add given inches
• Use the conversion formula (1 inch = 2.54
centimeters) to find the equivalent length in
centimeters
66
67. Programming Example: Convert
Length (continued)
• The algorithm is as follows:
− Get the length in feet and inches
− Convert the length into total inches
− Convert total inches into centimeters
− Output centimeters
67
68. Programming Example: Variables
and Constants
• Variables
int feet; //variable to hold given feet
int inches; //variable to hold given inches
int totalInches; //variable to hold total inches
double centimeters; //variable to hold length in
//centimeters
• Named Constant
const double CENTIMETERS_PER_INCH = 2.54;
const int INCHES_PER_FOOT = 12;
68
69. Programming Example: Main
Algorithm
• Prompt user for input
• Get data
• Echo the input (output the input)
• Find length in inches
• Output length in inches
• Convert length to centimeters
• Output length in centimeters
69
70. Programming Example: Putting It
Together
• Program begins with comments
• System resources will be used for I/O
• Use input statements to get data and output
statements to print results
• Data comes from keyboard and the output
will display on the screen
• The first statement of the program, after
comments, is preprocessor directive to
include header file iostream
70
71. Programming Example: Putting It
Together (continued)
• Two types of memory locations for data
manipulation:
− Named constants
• Usually put before main
− Variables
• This program has only one function (main),
which will contain all the code
• The program needs variables to manipulate
data, which are declared in main
71
72. Programming Example: Body of
the Function
• The body of the function main has the
following form:
int main ()
{
declare variables
statements
return 0;
}
72
73. Programming Example: Writing a
Complete Program
• Begin the program with comments for
documentation
• Include header files
• Declare named constants, if any
• Write the definition of the function main
73
75. Programming Example: Sample
Run
75
Enter two integers, one for feet, one for inches: 15 7
The numbers you entered are 15 for feet and 7 for inches.
The total number of inches = 187
The number of centimeters = 474.98
76. Summary
• C++ program: collection of functions where
each program has a function called main
• Identifier consists of letters, digits, and
underscores, and begins with letter or
underscore
• The arithmetic operators in C++ are addition
(+), subtraction (-),multiplication (*), division (/),
and modulus (%)
• Arithmetic expressions are evaluated using the
precedence associativity rules
76
77. Summary (continued)
• All operands in an integral expression are
integers and all operands in a floating-point
expression are decimal numbers
• Mixed expression: contains both integers and
decimal numbers
• Use the cast operator to explicitly convert
values from one data type to another
• A named constant is initialized when declared
• All variables must be declared before used
77
78. Summary (continued)
• Use cin and stream extraction operator >> to
input from the standard input device
• Use cout and stream insertion operator <<
to output to the standard output device
• Preprocessor commands are processed
before the program goes through the
compiler
• A file containing a C++ program usually ends
with the extension .cpp
78