C++ Keywords. If/else Selection Structure. Looping Control Structures. Switch Statements. Example Program

Size: px
Start display at page:

Download "C++ Keywords. If/else Selection Structure. Looping Control Structures. Switch Statements. Example Program"

Transcription

1 C++ Keywords There are many keywords in C++ that are not used in other languages. bool, const_cast, delete, dynamic_cast, const, enum, extern, register, sizeof, typedef, explicit, friend, inline, mutable, namespace, static_cast, template, typeid, typename, virtual If/else Selection Structure Example Program Switch Statements Switch statements are able to test int and char variables to handle multiple decisions. Code example. Looping Control Structures C++ provides three types of loop control structures. While loop Do/While loop The body of the loop is executed at least once. For loop Example code 1

2 Math Functions C++ provides predefined math functions in the Math Library. You need to simply refer to the name of the function with the proper parameters. The most common functions are listed on the handout. Function Definitions C++ Functions are defined using the following format: Return-value-type function-name (parameter-list) { } declarations and statements return XXX; Function Definitions Parameters to functions are considered local variables to the function. If there are no parameters the list is empty. The return type of a function must be defined. The return type for a function that does not return a data type is void. The Coding Standard requires that there be only one return statement per function at the end of the function. Function Definitions Functions can not be defined inside of other functions. Each function is an individual. 2

3 Function Prototypes C++ requires a function prototype for each function a class defines. The function prototype includes the function name, the parameter names and data types, and the order of the parameters. The function prototype should be stored in a *.h (header) file. Header Files C++ requires each class have both a *.C file as well has a header file *.h. The header file contains the function prototypes for all class functions as well as the definitions of the various attributes and constants for the class. Header Files C++ provides many predefined classes. To use these classes in your program you need to include (note: we will no longer use the Java import) them using: #include <nameofheaderfile>; Pages 2 and 3 of the handout lists many of the common Standard Library header files. Header Files To include a header file for a class you define use: #include nameoftheheaderfile.h For now we will only use class definitions from the Standard Library. 3

4 Data Types C++ includes the standard data types as well as data types that are unsigned. Unsigned data types include only positive numbers. The range of int includes both positive and negative integers. The range of unsigned int is as wide as int but includes only positive numbers. Enumeration Enumeration is a data type that creates a set of integer constant identifiers. The first identifier is set to zero (0), the second is assigned to one (1), etc. The identifiers can also be assigned a particular integer value. Enumeration identifier names are all capital letters. Enumeration identifiers make a program easier to understand. enum Status {CONTINUE, WON, LOST}; Storage classes are used to determine the period during which an identifier exists in memory. The storage class specifies are: auto, register, extern, mutable, and static. An identifier s storage class specifier determines the storage class, scope, and linkage of the identifier. Scope refers to where the identifier can be referenced in the program. Linkage determines, for a multiple-source-file program, whether an identifier is known only in the current source file or in any source file with proper declarations. 4

5 Automatic storage class creates variables when the block in which they are declared is entered, they exist while the block is active, and they are destroyed when the block is exited. Only variables can have automatic storage. There are two types: auto and register. By default, local variables in functions are auto. The register keyword can be used with local variables. Use register when the programmer wants to suggest that the compiler place the variable in one of the computer s high-speed hardware registers rather than memory. The compiler might ignore this definition. Only one storage class specifier can be applied to an identifier. The extern and static keywords declare identifiers for variables and functions that are in the static storage class. Variables of this type exist from the time the program begins execution. Memory is allocated and initialized when the program begins execution. Functions of this type exist from the point where the program begins execution. The extern class is associated with global variables and functions. NOTE: The RIT CS C++ Coding Standard does not permit the use of global variables and functions. The only exception is the main function. 5

6 The static keyword is used for local variables and functions. Static variables maintain their values when a function is exited so that the next time the function is executed the values are still available. Scope Rules Scope refers to the portion of a program where identifiers have meaning. Not all variables will be available to each function. You have dealt with scope in Java. Inline Functions C++ allows the definition of inline functions. Inline functions tell the compiler to generate a copy of the function s code in place to avoid a function call. Multiple copies of the function code are inserted into the program. Such functions must be preceded by the keyword inline. The compiler can choose to ignore such definitions. Inline Functions Inline functions should only be used for very simple, frequently used functions. inline return-type functionname (parameter list) { statement;} Example. 6

7 Call-By-Reference C++ allows functions calls to use Call-By- Reference. The calling function gives the called function the ability to directly access and modify the caller s data. Call-By-Reference eliminates the overhead of copying large amounts of data. This method does weaken security. To use this method, the reference parameter must be preceded by an ampersand (&). References Variables can be defined as a reference to another variable. Once a variable is defined as a reference, it can not be redefined to reference a different variable. int count = 1; int &countref = count; ++countref; References C++ does permit functions to return references, but you should not do this. The program quickly becomes very confusing. Function Overloading Function Overloading permits multiple functions with the same name to be defined as long as each function has a different set of parameters. The compiler will chose the proper version of the function based upon the parameter list. By definition, an overloaded function should execute the same task using different data types. 7

8 Function Overloading The overloaded functions do not have to have the same number of parameters. The return type of the functions can be different. Simply changing the return type, without changing the parameter list does not create an overloaded function. Function Overloading int square( int x) { return x * x; } double square (double x) {return x * x;} Function Templates Function Templates can be used to create overloaded functions that have an identical function body. Function templates will define a family of functions. The compiler will execute the proper version of the function based upon the passed data types. Template Example. Passing Arrays C++ passes entire arrays to functions using call-by-reference. This means that any changes to the array in the function will affect the original array data. C++ passes individual array elements to functions using call-by-value. This means that any changes to the value in the function do not affect the original array element data. 8

9 Array Length Java users should note that there is no length parameter for arrays in C++. Your program should pass the length of the array to each function or the function must count the number of elements in the array. Multi-dimensional Arrays C++ permits the development of m by n arrays. m rows and n columns. We will only work with two dimensional arrays. 2-D array example. 9

BHARATHIAR UNIVERSITY: COIMBATORE CENTRE FOR COLLABORATION OF INDUSTRY AND INSTITUTIONS(CCII) CERTIFICATE IN ADVANCED PROGRAMMING C++ LANGUAGE

BHARATHIAR UNIVERSITY: COIMBATORE CENTRE FOR COLLABORATION OF INDUSTRY AND INSTITUTIONS(CCII) CERTIFICATE IN ADVANCED PROGRAMMING C++ LANGUAGE Certificate in Advanced Programming - C++ Language Page 1 of 7 BHARATHIAR UNIVERSITY: COIMBATORE 641046 CENTRE FOR COLLABORATION OF INDUSTRY AND INSTITUTIONS(CCII) CERTIFICATE IN ADVANCED PROGRAMMING C++

More information

Chapter 8. Arithmetic in C++

Chapter 8. Arithmetic in C++ Christian Jacob Chapter 8 Arithmetic in C++ 8.1 The C++ Vocabulary 8.2 Variables and Types 8.2.1 Data Objects 8.2.2 Variables 8.2.3 Declaration of Variables 8.3 Elementary C++ Data Types 8.3.1 Integers

More information

SYSTEMS PROGRAMMING C++ INTRODUCTION

SYSTEMS PROGRAMMING C++ INTRODUCTION Faculty of Computer Science / Institute of Systems Architecture / Operating Systems SYSTEMS PROGRAMMING C++ INTRODUCTION Alexander Warg WHY C++? C++ is the language that allows to express ideas from the

More information

Measurement of Software Complexity. Testwell CMTJava. with Testwell CMT++ en_software_complexity_metrics

Measurement of Software Complexity. Testwell CMTJava. with Testwell CMT++  en_software_complexity_metrics Measurement of Software Complexity with Testwell CMT++ Testwell CMTJava www.verifysoft.com en_software_complexity_metrics 20121025 Code Complexity Measurements Code Complexity Measurement Tools Testwell

More information

1. Constants. 2. Variables. 3. Reserved words or key words. 4. Constants. Character set in C

1. Constants. 2. Variables. 3. Reserved words or key words. 4. Constants. Character set in C Character set in C We should use only the following characters in writing a C program. These characters can be combined to create C words. Alphabet: A, B, C, D.. Z, a, b, c, d..z Numeric digits: 0, 1,

More information

INDEX. C programming Page 1 of 10. 5) Function. 1) Introduction to C Programming

INDEX. C programming Page 1 of 10. 5) Function. 1) Introduction to C Programming INDEX 1) Introduction to C Programming a. What is C? b. Getting started with C 2) Data Types, Variables, Constants a. Constants, Variables and Keywords b. Types of Variables c. C Keyword d. Types of C

More information

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON PROBLEM SOLVING WITH SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON Addison Wesley Boston San Francisco New York London

More information

The C Programming Language course syllabus associate level

The C Programming Language course syllabus associate level TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming

More information

Summary. Pre requisition. Content Details: 1. Basics in C++

Summary. Pre requisition. Content Details: 1. Basics in C++ Summary C++ Language is one of the approaches to provide object-oriented functionality with C like syntax. C++ adds greater typing strength, scoping and other tools useful in object-oriented programming

More information

C++ Programming Language

C++ Programming Language C++ Programming Language Lecturer: Yuri Nefedov 7th and 8th semesters Lectures: 34 hours (7th semester); 32 hours (8th semester). Seminars: 34 hours (7th semester); 32 hours (8th semester). Course abstract

More information

CSE 303 Concepts and Tools for Software Development. Magdalena Balazinska Winter 2010 Lecture 19 Inheritance (virtual functions and abstract classes)

CSE 303 Concepts and Tools for Software Development. Magdalena Balazinska Winter 2010 Lecture 19 Inheritance (virtual functions and abstract classes) CSE 303 Concepts and Tools for Software Development Magdalena Balazinska Winter 2010 Lecture 19 Inheritance (virtual functions and abstract classes) Where We Are We have already covered the introduction

More information

Online C++ FAQ/Tutorial and Advanced Questions

Online C++ FAQ/Tutorial and Advanced Questions Online C++ FAQ/Tutorial and Advanced Questions Alexis Angelidis January 11, 2005 1 Quick notes to C programmers instead of macros use const or enum to define constants inline to prevent function call overload

More information

C++ INTERVIEW QUESTIONS

C++ INTERVIEW QUESTIONS C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get

More information

M3-R4: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE

M3-R4: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE M3-R4: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE NOTE: IMPORTANT INSTRUCTIONS: 1. Question Paper in English and Hindi and Candidate can choose any one language. 2. In case of discrepancies in

More information

C++ CLASSES C/C++ ADVANCED PROGRAMMING

C++ CLASSES C/C++ ADVANCED PROGRAMMING C++ CLASSES C/C++ ADVANCED PROGRAMMING GOAL OF THIS LECTURE C++ classes Dr. Juan J. Durillo 2 (C++) CLASSES: BASIC CONCEPTS Fundamentals of classes data abstraction data encapsulation Data abstraction:

More information

C Primer. Fall Introduction C vs. Java... 1

C Primer. Fall Introduction C vs. Java... 1 CS 33 Intro Computer Systems Doeppner C Primer Fall 2016 Contents 1 Introduction 1 1.1 C vs. Java.......................................... 1 2 Functions 1 2.1 The main() Function....................................

More information

C++ for Game Programmers

C++ for Game Programmers C++ for Game Programmers Course Description C++ has become one of the favourite programming language for game programmers. Reasons for wide spread acceptability of C++ are plenty, but primary reasons are,

More information

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas CS 110B - Rule Storage Classes Page 18-1 Attributes are distinctive features of a variable. Data type, int or double for example, is an attribute. Storage class is another attribute. There are four storage

More information

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

KITES TECHNOLOGY COURSE MODULE (C, C++, DS) KITES TECHNOLOGY 360 Degree Solution www.kitestechnology.com/academy.php info@kitestechnology.com technologykites@gmail.com Contact: - 8961334776 9433759247 9830639522.NET JAVA WEB DESIGN PHP SQL, PL/SQL

More information

El Dorado Union High School District Educational Services

El Dorado Union High School District Educational Services El Dorado Union High School District Course of Study Information Page Course Title: ACE Computer Programming II (#495) Rationale: A continuum of courses, including advanced classes in technology is needed.

More information

Advanced Systems Programming

Advanced Systems Programming Advanced Systems Programming Introduction to C++ Martin Küttler September 23, 2016 1 / 21 About this presentation 2 / 21 About this presentation This presentation is not about learning to program 2 / 21

More information

Lecture 5. Function Pointers

Lecture 5. Function Pointers Lecture 5 Complicated declarations Pointers to functions Templates Classes const member functions Constructors and destructor Allocating and deallocating memory Common pitfalls TNCG18 (C++): Lec 5 1 Function

More information

Which of the following is the correct operator to compare two variables? A. := B. = C. equal D. ==

Which of the following is the correct operator to compare two variables? A. := B. = C. equal D. == Group 1 Question 1. What is the correct value to return to the operating system upon the successful completion of a program? A. -1 B. 1 C. 0 D. Programs do not return a value. Question 2. What is the only

More information

Chapter 5 Functions. Introducing Functions

Chapter 5 Functions. Introducing Functions Chapter 5 Functions 1 Introducing Functions A function is a collection of statements that are grouped together to perform an operation Define a function Invoke a funciton return value type method name

More information

VB.NET Programming Fundamentals

VB.NET Programming Fundamentals Chapter 3 Objectives Programming Fundamentals In this chapter, you will: Learn about the programming language Write a module definition Use variables and data types Compute with Write decision-making statements

More information

Example Solution to Exam in EDA150 C Programming

Example Solution to Exam in EDA150 C Programming Example Solution to Exam in EDA150 C Programming Janurary 12, 2011, 14-19 Inga hjälpmedel! Examinator: Jonas Skeppstedt, tel 0767 888 124 30 out of 60p are needed to pass the exam. General Remarks A function

More information

Programming for MSc Part I

Programming for MSc Part I Herbert Martin Dietze University of Buckingham herbert@the-little-red-haired-girl.org July 24, 2001 Abstract The course introduces the C programming language and fundamental software development techniques.

More information

A C# program structure About variables Predefined Data Types Flow Control Enumerations Arrays Namespaces The Main() method. Console IO Comments

A C# program structure About variables Predefined Data Types Flow Control Enumerations Arrays Namespaces The Main() method. Console IO Comments Basics of C# What are we going to study? A C# program structure About variables Predefined Data Types Flow Control Enumerations Arrays Namespaces The Main() method Compilation of C# program Console IO

More information

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C 1 An essential part of any embedded system design Programming 2 Programming in Assembly or HLL Processor and memory-sensitive

More information

Advanced C++ Exception Handling Topic #5

Advanced C++ Exception Handling Topic #5 Advanced C++ Exception Handling Topic #5 CS202 5-1 CS202 5-2 Exception Handling Throwing an Exception Detecting an Exception Catching an Exception Examine an Example using Classes and Operator Overloading

More information

Using Image Processing and Visualization to Teach Object Oriented Programming in C++

Using Image Processing and Visualization to Teach Object Oriented Programming in C++ Using Image Processing and Visualization to Teach Object Oriented Programming in C++ Author: C. Rolstad, Oslo University College, Cort Adelersgate 30, 0254 Oslo, Norway. cecilier@iu.hio.no Abstract When

More information

W 3.1, 3.2. C++ Functions Modular Program Design. Introduction toc and C++. CA212 Brian Stone

W 3.1, 3.2. C++ Functions Modular Program Design. Introduction toc and C++. CA212 Brian Stone W 3.1, 3.2 C++ Functions Modular Program Design Introduction toc and C++. CA212 Brian Stone 2001 1 Functions Functions allow a program to be broken down into smaller units of code. Modular programming

More information

Introduction to C++ Programming Vahid Kazemi

Introduction to C++ Programming Vahid Kazemi Introduction to C++ Programming Vahid Kazemi Overview An overview of C/C++ - Basic types, Pointers, Arrays, Program control, Functions, Arguments, Structures, Operator overloading, Namespaces, Classes,

More information

TN203. Porting a Program to Dynamic C. Introduction

TN203. Porting a Program to Dynamic C. Introduction TN203 Porting a Program to Dynamic C Introduction Dynamic C has a number of improvements and differences compared to many other C compiler systems. This application note gives instructions and suggestions

More information

Comparative Study of C, C++, C# and Java Programming Languages Mrs. Partibha 1, Mrs. Ashu Khokhar 2

Comparative Study of C, C++, C# and Java Programming Languages Mrs. Partibha 1, Mrs. Ashu Khokhar 2 Comparative Study of C, C++, C# and Java Programming Languages Mrs. Partibha 1, Mrs. Ashu Khokhar 2 1,2 Lecturer, PG Department of Computer Science, Jat College, Rohtak, Haryana ABSTRACT: By the comparative

More information

Lecture 2. Functions in C++

Lecture 2. Functions in C++ Lecture 2 Functions Declaration (prototype) Definition (implementation) Function calls Parameters Call by reference Call by value Return value Function overloading Header files Standard library: cmath,

More information

Optimization Techniques in C. Team Emertxe

Optimization Techniques in C. Team Emertxe Optimization Techniques in C Team Emertxe Optimization Techniques Basic Concepts Programming Algorithm and Techniques Optimization Techniques Basic Concepts What is Optimization Methods Space and Time

More information

IS0020 Program Design and Software Tools Midterm, Feb 24, 2004. Instruction

IS0020 Program Design and Software Tools Midterm, Feb 24, 2004. Instruction IS0020 Program Design and Software Tools Midterm, Feb 24, 2004 Name: Instruction There are two parts in this test. The first part contains 50 questions worth 80 points. The second part constitutes 20 points

More information

C++ Language Tutorial

C++ Language Tutorial cplusplus.com C++ Language Tutorial Written by: Juan Soulié Last revision: June, 2007 Available online at: http://www.cplusplus.com/doc/tutorial/ The online version is constantly revised and may contain

More information

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement? 1. Distinguish & and && operators. PART-A Questions 2. How does an enumerated statement differ from a typedef statement? 3. What are the various members of a class? 4. Who can access the protected members

More information

Punctuation in C. Identifiers and Expressions. Identifiers. Variables. Keywords. Identifier Examples

Punctuation in C. Identifiers and Expressions. Identifiers. Variables. Keywords. Identifier Examples Identifiers and Expressions CSE 130: Introduction to C Programming Spring 2005 Punctuation in C Statements are terminated with a ; Groups of statements are enclosed by curly braces: { and } Commas separate

More information

C++ for Scientific Computing

C++ for Scientific Computing C++ for Scientific Computing Ronald Kriemann MPI MIS Leipzig 2012-10-01 R. Kriemann,»C++ for Scientific Computing«1/316 1. Introduction 2. Variables and Datatypes 3. Arithmetic Operators 4. Type Casting

More information

Basic C Syntax. Comp-206 : Introduction to Software Systems Lecture 10. Alexandre Denault Computer Science McGill University Fall 2006

Basic C Syntax. Comp-206 : Introduction to Software Systems Lecture 10. Alexandre Denault Computer Science McGill University Fall 2006 Basic C Syntax Comp-206 : Introduction to Software Systems Lecture 10 Alexandre Denault Computer Science McGill University Fall 2006 Next Week I'm away for the week. I'll still check my mails though. No

More information

MSP430 C/C++ CODE GENERATION TOOLS Compiler Version 3.2.X Parser Error/Warning/Remark List

MSP430 C/C++ CODE GENERATION TOOLS Compiler Version 3.2.X Parser Error/Warning/Remark List MSP430 C/C++ CODE GENERATION TOOLS Compiler Version 3.2.X Parser Error/Warning/Remark List This is a list of the error/warning messages generated by the Texas Instruments C/C++ parser (which we license

More information

7 Introduction to C++

7 Introduction to C++ 7 Introduction to C++ 7.1 Introduction C++ is an extension to C Programming language. It was developed at AT&T Bell Laboratories in the early 1980s by Bjarne Stroustrup. It is a deviation from traditional

More information

Arrays. In C++, all indexes start at zero. The first element of the array a is referred to as a[0], the second element as a[1], the third as a[?]..

Arrays. In C++, all indexes start at zero. The first element of the array a is referred to as a[0], the second element as a[1], the third as a[?].. Arrays Definition: An array is a collection of variables of the same type that are referenced by a common name. -In C++, all arrays consist of contiguous memory locations. -To refer to an element or particular

More information

C Programming Dr. Hasan Demirel

C Programming Dr. Hasan Demirel C How to Program, H. M. Deitel and P. J. Deitel, Prentice Hall, 5 th edition (3 rd edition or above is also OK). Introduction to C Programming Dr. Hasan Demirel Programming Languages There are three types

More information

STRUCTURES IN C PROGRAMMING

STRUCTURES IN C PROGRAMMING STRUCTURES IN C PROGRAMMING A structure can be considered as a template used for defining a collection of variables under a single name. Structures help programmers to group elements of different data

More information

Variables and Constants

Variables and Constants HOUR 3 Variables and Constants What You ll Learn in This Hour:. How to declare and define variables and constants. How to assign values to variables and manipulate those values. How to write the value

More information

Operator Overloading; String and Array Objects

Operator Overloading; String and Array Objects 11 Operator Overloading; String and Array Objects The whole difference between construction and creation is exactly this: that a thing constructed can only be loved after it is constructed; but a thing

More information

Review: arrays, pointers, structures (Chapter 1) Data Types. Review: Arrays. Data Types (C/C++) Data Type: CS 3358 Summer I 2012.

Review: arrays, pointers, structures (Chapter 1) Data Types. Review: Arrays. Data Types (C/C++) Data Type: CS 3358 Summer I 2012. Review: arrays, pointers, structures (Chapter 1) Data Types Data Type: CS 3358 Summer I 2012 Jill Seaman set of values set of operations over those values example: Integer whole numbers, -32768 to 32767

More information

CSCE 206: Structured Programming in C++

CSCE 206: Structured Programming in C++ CSCE 206: Structured Programming in C++ 2016 Fall Exam 3 Friday, November 18, 2016 Total - 100 Points B Instructions: Total of 11 pages, including this cover and the last page. Before starting the exam,

More information

CSCE 206: Structured Programming in C++

CSCE 206: Structured Programming in C++ CSCE 206: Structured Programming in C++ 2016 Fall Exam 3 Friday, November 18, 2016 Total - 100 Points A Instructions: Total of 11 pages, including this cover and the last page. Before starting the exam,

More information

Chapter 13 Storage classes

Chapter 13 Storage classes Chapter 13 Storage classes 1. Storage classes 2. Storage Class auto 3. Storage Class extern 4. Storage Class static 5. Storage Class register 6. Global and Local Variables 7. Nested Blocks with the Same

More information

Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies)

Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies) Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies) Duration of Course: 6 Months Fees: Rs. 25,000/- (including Service Tax) Eligibility: B.E./B.Tech., M.Sc.(IT/ computer

More information

Function Definitions

Function Definitions Functions 8 22 absdiff 14 1. Perspective is messed up here. 2. Picture needs to be redone in truespace. 3. Think of a function as a black box (meaning you shouldn't worry about what is happening inside)

More information

Borland C++ Compiler: Operators

Borland C++ Compiler: Operators Introduction Borland C++ Compiler: Operators An operator is a symbol that specifies which operation to perform in a statement or expression. An operand is one of the inputs of an operator. For example,

More information

modifier returnvaluetype methodname(list of parameters) { // Method body; }

modifier returnvaluetype methodname(list of parameters) { // Method body; } JAVA METHODS METHODS A Java method is similar to function in C/C++. It is a collection of statements that are grouped together to perform an operation. When you call the System.out.println method, for

More information

CS201- Introduction to Programming Latest Solved Mcqs from Final term Papers July 11,2011

CS201- Introduction to Programming Latest Solved Mcqs from Final term Papers July 11,2011 CS201- Introduction to Programming Latest Solved Mcqs from Final term Papers July 11,2011 Mc100401285 moaaz.pk@gmail.com Moaaz Siddiq Bc100400662 bc100400662asad@gmail.com Asad Ali Latest Mcqs FINALTERM

More information

Introduction to C Programming S Y STEMS

Introduction to C Programming S Y STEMS Introduction to C Programming CS 40: INTRODUCTION TO U NIX A ND L I NUX O P E R AT ING S Y STEMS Objectives Introduce C programming, including what it is and what it contains, which includes: Command line

More information

C++FA 5.1 PRACTICE MID-TERM EXAM

C++FA 5.1 PRACTICE MID-TERM EXAM C++FA 5.1 PRACTICE MID-TERM EXAM This practicemid-term exam covers sections C++FA 1.1 through C++FA 1.4 of C++ with Financial Applications by Ben Van Vliet, available at www.benvanvliet.net. 1.) A pointer

More information

C++ Programming: From Problem Analysis to Program Design, Fifth Edition. Chapter 2: Basic Elements of C++

C++ Programming: From Problem Analysis to Program Design, Fifth Edition. Chapter 2: Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with the basic components of a C++ program,

More information

COURSE CONTENTS. 3 -months 8:30 am - 3:30 pm Mon - Fri. [Admissions strictly through written test based on Basic C and Aptitude]

COURSE CONTENTS. 3 -months 8:30 am - 3:30 pm Mon - Fri. [Admissions strictly through written test based on Basic C and Aptitude] COURSE CONTENTS 3 -months 8:30 am - 3:30 pm Mon - Fri [Admissions strictly through written test based on Basic C and Aptitude] Subhash Programming Classes Revision: January, 2016 All rights reserved Call:

More information

A First Book of C++ Chapter 2 Data Types, Declarations, and Displays

A First Book of C++ Chapter 2 Data Types, Declarations, and Displays A First Book of C++ Chapter 2 Data Types, Declarations, and Displays Objectives In this chapter, you will learn about: Data Types Arithmetic Operators Variables and Declarations Common Programming Errors

More information

NIIT. Table of Contents. Introduction. Lesson 1 Introduction to Object-Oriented Approach. Lesson 2 Creating Objects

NIIT. Table of Contents. Introduction. Lesson 1 Introduction to Object-Oriented Approach. Lesson 2 Creating Objects Introduction Table of Contents About This Course...i Who Should Attend this Course...i How to Use this Book... ii Conventions Used in this Book... ii Lesson 1 Introduction to Object-Oriented Approach Object-Oriented

More information

OSMIC. CSoft ware. C Language manual. Rev Copyright COSMIC Software 1999, 2003 All rights reserved.

OSMIC. CSoft ware. C Language manual. Rev Copyright COSMIC Software 1999, 2003 All rights reserved. OSMIC CSoft ware C Language manual Rev. 1.1 Copyright COSMIC Software 1999, 2003 All rights reserved. Table of Contents Preface Chapter 1 Historical Introduction Chapter 2 C Language Overview C Files...2-1

More information

An Incomplete C++ Primer. University of Wyoming MA 5310

An Incomplete C++ Primer. University of Wyoming MA 5310 An Incomplete C++ Primer University of Wyoming MA 5310 Professor Craig C. Douglas http://www.mgnet.org/~douglas/classes/na-sc/notes/c++primer.pdf C++ is a legacy programming language, as is other languages

More information

Quick Introduction to C++

Quick Introduction to C++ Quick Introduction to C++ Wayne A. Christopher handout for CS 162, UC Berkeley, 1992 (freely adapted by Riccardo Bettati ) C makes it easy to shoot yourself in the foot. C++ makes it harder, but when you

More information

Applied Informatics C++ Coding Style Guide

Applied Informatics C++ Coding Style Guide C++ Coding Style Guide Rules and Recommendations Version 1.4 Purpose of This Document This document describes the C++ coding style employed by Applied Informatics. The document is targeted at developers

More information

Comp151. Definitions & Declarations

Comp151. Definitions & Declarations Comp151 Definitions & Declarations Example: Definition /* reverse_printcpp */ #include #include using namespace std; int global_var = 23; // global variable definition void reverse_print(const

More information

Moving from CS 61A Scheme to CS 61B Java

Moving from CS 61A Scheme to CS 61B Java Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you

More information

Chapter 9 Review-C++ True/False Indicate whether the sentence or statement is true or false.

Chapter 9 Review-C++ True/False Indicate whether the sentence or statement is true or false. Chapter 9 Review-C++ True/False Indicate whether the sentence or statement is true or false. 1. It is legal to use the assignment operator (=) with character arrays. 2. The array arr[30] contains 30 elements.

More information

Basic Common Unix commands: Change to directory d

Basic Common Unix commands: Change to directory d Basic Common Unix commands: cd d Change to directory d mkdir d rmdir d mv f1 [f2...] d mv d1 d2 ls [d] [f...] ls -1 [f...] vi [f] emacs [f] more f cp f1 f2 mv f1 f2 rm f gcc [-o f1] f2 gnuplot Create new

More information

Lecture 3. Arrays. Name of array. c[0] c[1] c[2] c[3] c[4] c[5] c[6] c[7] c[8] c[9] c[10] c[11] Position number of the element within array c

Lecture 3. Arrays. Name of array. c[0] c[1] c[2] c[3] c[4] c[5] c[6] c[7] c[8] c[9] c[10] c[11] Position number of the element within array c Lecture 3 Data structures arrays structs C strings: array of chars Arrays as parameters to functions Multiple subscripted arrays Structs as parameters to functions Default arguments Inline functions Redirection

More information

A brief introduction to C++ and Interfacing with Excel

A brief introduction to C++ and Interfacing with Excel A brief introduction to C++ and Interfacing with Excel ANDREW L. HAZEL School of Mathematics, The University of Manchester Oxford Road, Manchester, M13 9PL, UK CONTENTS 1 Contents 1 Introduction 3 1.1

More information

C Programming, Chapter 1: C vs. Java, Types, Reading and Writing

C Programming, Chapter 1: C vs. Java, Types, Reading and Writing C Programming, Chapter 1: C vs. Java, Types, Reading and Writing T. Karvi August 2013 T. Karvi C Programming, Chapter 1: C vs. Java, Types, Reading and Writing August 2013 1 / 1 C and Java I Although the

More information

Sources: On the Web: Slides will be available on:

Sources: On the Web: Slides will be available on: C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,

More information

JAVA PRIMITIVE DATA TYPE

JAVA PRIMITIVE DATA TYPE JAVA PRIMITIVE DATA TYPE Description Not everything in Java is an object. There is a special group of data types (also known as primitive types) that will be used quite often in programming. For performance

More information

Computers process data under the control of sets of instructions called computer programs.

Computers process data under the control of sets of instructions called computer programs. Introduction Computer is a device capable of performing computations and making logical decisions at speeds millions and even billions of times faster than human beings. Computers process data under the

More information

Strings in Java String Objects

Strings in Java String Objects Strings in Java are objects. They are instances of the class String (in the package java.lang). As is the case with other objects, String variables are actually references to a String object in memory.

More information

Adjusted/Modified by Nicole Tobias. Chapter 2: Basic Elements of C++

Adjusted/Modified by Nicole Tobias. Chapter 2: Basic Elements of C++ Adjusted/Modified by Nicole Tobias Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types

More information

MC 0500 Object Oriented Programming using C++ INDEX. S.No. Contents Date of Completion. 3. Operator Overloading and type conversion

MC 0500 Object Oriented Programming using C++ INDEX. S.No. Contents Date of Completion. 3. Operator Overloading and type conversion MC 0500 Object Oriented Programming using C++ INDEX S.No. Contents Date of Completion 1. Simple Programs 2. Classes and Objects 3. Operator Overloading and type conversion 4. Inheritance 5. File I/O Staff

More information

MPI and C-Language Seminars 2010

MPI and C-Language Seminars 2010 MPI and C-Language Seminars 2010 Seminar Plan (1/3) Aim: Introduce the C Programming Language. Plan to cover: Basic C, and programming techniques needed for HPC coursework. C-bindings for the Message Passing

More information

C++: Type Traits.

C++: Type Traits. C++: Type Traits Miro Jurišić meeroh@meeroh.org Introduction Classes which encapsulate properties of types Is this an integer type? An arithmetic type? A pointer type?... Closely related to partial specialization

More information

PIC Microcontrollers The basics of C programming language

PIC Microcontrollers The basics of C programming language Page 1 / 28 Page 2 / 28 Table of contents PROGRAMMING LANGUAGES...3 ADVANTAGES OF HIGHER PROGRAMMING LANGUAGES...6 PREPROCESSOR... 6 PREPROCESSOR DIRECTIVE # include... 7 PREPROCESSOR DIRECTIVE # define...7

More information

PE1 Worksheet. 3) What are the three control structures for writing an algorithm in pseudocode?

PE1 Worksheet. 3) What are the three control structures for writing an algorithm in pseudocode? PE1 Worksheet Problem solving 1) What are the four stages of problem solving by programming? What shall be done in each stage? Stage 1: Stage 2: Stage 3: Stage 4: 2) What is the top-down design strategy

More information

C++FA 3.1 OPTIMIZING C++

C++FA 3.1 OPTIMIZING C++ C++FA 3.1 OPTIMIZING C++ Ben Van Vliet Measuring Performance Performance can be measured and judged in different ways execution time, memory usage, error count, ease of use and trade offs usually have

More information

VU Mobile Powered by S NO Group All Rights Reserved S NO Group 2012

VU Mobile Powered by S NO Group All Rights Reserved S NO Group 2012 1 CS304 Final Term Solved MCQs Mega File (Latest All in One) User can make virtual table explicitly. True False In order to define a class template the first line of definition must be: template

More information

AP Computer Science Java Mr. Clausen Program 9A, 9B

AP Computer Science Java Mr. Clausen Program 9A, 9B AP Computer Science Java Mr. Clausen Program 9A, 9B PROGRAM 9A I m_sort_of_searching (20 points now, 60 points when all parts are finished) The purpose of this project is to set up a program that will

More information

Lecture 03 Bits, Bytes and Data Types

Lecture 03 Bits, Bytes and Data Types Lecture 03 Bits, Bytes and Data Types In this lecture Computer Languages Assembly Language The compiler Operating system Data and program instructions Bits, Bytes and Data Types ASCII table Data Types

More information

Boolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority)

Boolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority) Boolean Expressions, Conditions, Loops, and Enumerations Relational Operators == // true if two values are equivalent!= // true if two values are not equivalent < // true if left value is less than the

More information

AP Computer Science Java Subset

AP Computer Science Java Subset APPENDIX A AP Computer Science Java Subset The AP Java subset is intended to outline the features of Java that may appear on the AP Computer Science A Exam. The AP Java subset is NOT intended as an overall

More information

www.sahajsolns.com Chapter 4 OOPS WITH C++ Sahaj Computer Solutions

www.sahajsolns.com Chapter 4 OOPS WITH C++ Sahaj Computer Solutions Chapter 4 OOPS WITH C++ Sahaj Computer Solutions 1 Session Objectives Classes and Objects Class Declaration Class Members Data Constructors Destructors Member Functions Class Member Visibility Private,

More information

Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void

Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void 1. Explain C tokens Tokens are basic building blocks of a C program. A token is the smallest element of a C program that is meaningful to the compiler. The C compiler recognizes the following kinds of

More information

AFF 826. Sub. Code 4BSO1C1. Sp2. B.Sc. DEGREE EXAMINATION, NOVEMBER First Semester. Software FUNDAMENTALS OF COMPUTERS AND C PROGRAMMING

AFF 826. Sub. Code 4BSO1C1. Sp2. B.Sc. DEGREE EXAMINATION, NOVEMBER First Semester. Software FUNDAMENTALS OF COMPUTERS AND C PROGRAMMING Sp2 AFF 826 Sub. Code 4BSO1C1 B.Sc. DEGREE EXAMINATION, NOVEMBER 2015 First Semester Software FUNDAMENTALS OF COMPUTERS AND C PROGRAMMING (CBCS 2014 onwards) Time : 3 Hours Maximum : 75 Marks Part A (10

More information

Programming in C 1. Bharat Kinariwala Tep Dobry. 1 Copyright c1993 by B.Kinariwala and T. Dobry. All rights reserved.

Programming in C 1. Bharat Kinariwala Tep Dobry. 1 Copyright c1993 by B.Kinariwala and T. Dobry. All rights reserved. Programming in C 1 Bharat Kinariwala University ofhawai`i Tep Dobry University ofhawai`i January 5, 1993 1 Copyright c1993 by B.Kinariwala and T. Dobry. All rights reserved. Contents Table of Contents

More information

Using the Visual C++ Environment

Using the Visual C++ Environment Using the Visual C++ Environment This guide is eminently practical. We will step through the process of creating and debugging a C++ program in Microsoft Visual C++. The Visual C++ Environment The task

More information

IBM i Version 7.3. Programming IBM Rational Development Studio for i ILE C/C++ Language Reference IBM SC

IBM i Version 7.3. Programming IBM Rational Development Studio for i ILE C/C++ Language Reference IBM SC IBM i Version 7.3 Programming IBM Rational Development Studio for i ILE C/C++ Language Reference IBM SC09-7852-04 IBM i Version 7.3 Programming IBM Rational Development Studio for i ILE C/C++ Language

More information

An introduction to C++ Templates

An introduction to C++ Templates An introduction to C++ Templates For : COP 3330. Object oriented Programming (Using C++) http://www.compgeom.com/~piyush/teach/3330 Templates Are C macros on Steroids Give you the power to parametrize

More information

Proposal to add an absolute difference function to the C++ Standard Library

Proposal to add an absolute difference function to the C++ Standard Library Proposal to add an absolute difference function to the C++ Standard Library Document number: N4318 Date: 2014-09-21 Project: Programming Language C++, Library Evolution Working Group Reply-to: Jeremy Turnbull

More information