Welcome Application. Introduction to C++ Programming (Solutions) 2004 by Deitel & Associates, Inc. All Rights Reserved.

Size: px
Start display at page:

Download "Welcome Application. Introduction to C++ Programming (Solutions) 2004 by Deitel & Associates, Inc. All Rights Reserved."

Transcription

1 T U T O R I A L 2 Welcome Application Introduction to C++ Programming (Solutions) 1

2 2 Introduction to C++ Programming (Solutions) Tutorial 2 These solutions will not be available to students. Instructor s Manual Exercise Solutions Tutorial 2 MULTIPLE-CHOICE QUESTIONS 2.1 Use the object to display text on the screen. a) screen b) cout c) output d) iostream 2.2 To compile an application in Visual Studio.NET, select. a) File > Compile Solution b) Build > Compile Solution c) Build > Build Solution d) Compile > Build Solution 2.3 must begin the body of every function. a) A newline character b) The int keyword c) A return statement d) A left brace ({ ) 2. Syntax errors in a C++ application. a) can cause subtle errors when the application runs 2.5 Files with a.obj extension contain. 2. Operator << is the operator. 2.7 The escape sequence sounds the system bell. 2.8 To run an application using Visual Studio.NET, select. 2.9 A is an example of whitespace character. b) prevent the application from compiling correctly c) are ignored by the compiler d) are detected after the application has been compiled a) source code b) an executable image c) machine code d) preprocessor information a) stream insertion b) stream extraction c) display d) cout a) \b b) \a c) \sb d) None of the above. a) Run > Start Without Debugging b) Build > Start c) Debug > Start Without Debugging d) Run > Start a) tab b) space c) newline d) All of the above The escape sequence places the cursor at the beginning of the current line. a) \n b) \r c) \t d) \b Answers: 2.1) b. 2.2) c. 2.3) d. 2.) b. 2.5) c. 2.) a. 2.7) b. 2.8) c. 2.9) d. 2.10) b. EXERCISES 2. ( Alarm Application) Many universities provide computer networks that enable multiple users to access information on the local area network (LAN) and on the Internet. To increase security, the system will log off a user if that user has been inactive for a significant period of time. Suppose the system administrator wants the system to warn the user before logging off. In this exercise, you will create an application that displays a message to the user

3 Tutorial 2 Welcome Application 3 and sounds the system bell three times to indicate that the user will be logged off in one minute (Fig.2.35). Figure 2.35 Alarm application output for completed application. Answer: a) Copying the template to your working directory. Copy the directory C:\Examples\ Tutorial02\Exercises\Alarm to your C:\SimplyCpp directory. If you are not using Visual Studio.NET, skip to Step c. b) Creating a new project. If you have not already done so, start Visual Studio.NET.To create a new project, select File > New > Project, causing the New Project dialog to display. Click the Visual C++ Projects folder in the Project Types: pane to display the list of Visual C++.NET project types in the Templates: pane. Select Win32 Console Project from the Templates: pane. In the Win32 Application Wizard, click the Application Settings link, select the Empty project check box, then click Finish. Name the project Alarm. Save this project in your SimplyCpp directory.then add the existing source code file, Alarm.cpp, which is located in the C:\SimplyCpp\Alarm directory. c) Opening the template file. Open the Alarm.cpp file in your text editor or IDE. d) Displaying a message to the user. Before sounding the system bell, you should display a warning message to the user.after line 9 in the template code, insert a statement to display a newline and the message, "Warning: You have been inactive for over 30 minutes.". Do not terminate the statement yet. Insert a second stream insertion operator on the next line of your application s source code to display the text, "You will be logged out in one minute." This text should be displayed on a new line, using the newline escape sequence. Two newlines should be inserted after this message is displayed. Remember to terminate the second line of your statement with a semicolon. e) Sounding the system bell. To sound the system bell, display a string that consists of three alert escape sequences. f) Save your modified source code file. g) Compile the completed application. h) Running the completed application. Select Debug > Start Without Debugging to run your application. Compare the program output to the one shown in Fig to ensure that you displayed the message to the user correctly. [Note: Depending on the system you are using, you may not hear the computer s system bell or the three bells may sound so quickly that you may hear the system bell sound only once when the application runs.] i) Close the Command Prompt window. j) Close your text editor or IDE. 1 // Exercise 2. 2 // Application that prints a message and sounds an alarm. 10 cout << "\nwarning: You have been inactive for over 30 minutes." << "\nyou will be logged out in one minute.\n\n";

4 Introduction to C++ Programming (Solutions) Tutorial 2 cout << "\a\a\a"; 1 15 return 0 ; // indicate that program ended successfully 1 17 } // end function main 2. ( Table of Powers Application) Throughout this book, you will be asked to create C++ applications that display tables of values. In this exercise, you will use the tab and newline escape sequences to display a table of the squares and cubes of the numbers from zero to 5 (Fig. 2.3). In a later tutorial, you will modify the application to calculate the values displayed in Fig.2.3. Figure 2.3 Table of Powers application output. a) Copying the template to your working directory. Copy the directory C:\Examples\ Tutorial02\Exercises\TableOfPowers to your C:\SimplyCpp directory. If you are not using Visual Studio.NET, skip to Step c. b) Creating a new project. If you have not already done so, start Visual Studio.NET.To create a new project, select File > New > Project, causing the New Project dialog to display. Click the Visual C++ Projects folder in the Project Types: pane to display the list of Visual C++.NET project types in the Templates: pane. Select Win32 Console Project from the Templates: pane. In the Win32 Application Wizard, click the Application Settings link, select the Empty project check box, then click Finish. Name the project TableOfPowers. Save this project in your SimplyCpp directory. Then add the existing source code file, TableOfPowers.cpp, which is located in the C:\SimplyCpp\TableOfPowers directory. c) Opening the template file. Open the TableOfPowers.cpp file in your text editor. d) Displaying the table header. When displaying a table of values, each column of values typically is separated by at least one tab character.you should always begin the table with a header, which is a line of text that labels each column, so that the user can identify the contents of each column. In this application, the first column will display a number, the second column will display its square and the third column will display its cube. Display a line of text containing the words number, square and cube, separated by tab escape sequences.terminate the output string with a newline escape sequence. e) Displaying the values. For the first row of values, display three zeros, each separated by tab escape sequences.terminate the output string with a newline escape sequence. For the next five rows, use the values in Fig.2.3, separating each value by a tab escape sequence and ending each output string with a newline escape sequence.add a second newline escape sequence to the last output string. f) Save your modified source code file. g) Compile the completed application. h) Running the completed application. Select Debug > Start Without Debugging to run your application. Compare the output of your completed Table of Powers application with the output shown in Fig. 2.3 to ensure that you wrote your application correctly. i) Close the Command Prompt window. j) Close your text editor or IDE.

5 Tutorial 2 Welcome Application 5 Answer: 1 // Exercise 2. 2 // Create an application that displays a table of powers cout << "Number\tSquare\tCube\n"; cout << "0\t0\t0\n"; cout << "1\t1\t1\n"; cout << "2\t\t8\n"; cout << "3\t9\t27\n"; cout << "\t1\t\n"; cout << "5\t25\t5\n\n"; 18 return 0 ; // indicate that program ended successfully } // end function main 2. (Restaurant Survey Application) In the next tutorial, you will learn how to create applications that retrieve input that the user types at the keyboard. To improve ease of use, many C++ applications include a numbered list of options, called a menu, from which users choose. Instead of typing the name of an option, the user simply enters the option s number. For example, many restaurants allow you to place an order using a number corresponding to a particular menu item. In this exercise, you display a menu of options for a restaurant (Fig.2.37). In later tutorials, you will create applications that respond to the user s selection. Figure 2.37 Restaurant Survey application output. a) Copying the template to your working directory. Copy the directory C:\Examples\ Tutorial02\Exercises\RestaurantSurvey to your C:\SimplyCpp directory. If you are not using Visual Studio.NET, skip to Step c. b) Creating a new project. If you have not already done so, start Visual Studio.NET.To create a new project, select File > New > Project, causing the New Project dialog to display. Click the Visual C++ Projects folder in the Project Types: pane to display the list of Visual C++.NET project types in the Templates: pane. Select Win32 Console Project from the Templates: pane. In the Win32 Application Wizard, click the Application Settings link, select the Empty project check box, then click Finish. Name the project RestaurantSurvey. Save this project in your SimplyCpp directory. Then add the existing source code file, RestaurantSurvey.cpp, which is located in the C:\SimplyCpp\RestaurantSurvey directory. c) Opening the template file. Open the RestaurantSurvey.cpp file in your text editor or IDE. d) Displaying the menu header. Before displaying the menu, you should display a message instructing the user to select one of the options that will follow. Use a cout statement to display a blank line followed by the message, "Select a menu option", followed by a newline escape sequence.

6 Introduction to C++ Programming (Solutions) Tutorial 2 Answer: e) Displaying the first menu option. Each menu item should consist of the option s number and a description of the option. The options should be presented in increasing numerical order. In this case, the first option is a hamburger. Therefore, display the message "1 - Hamburger" and insert a newline escape sequence to terminate the line. f) Displaying the remaining menu options. The second menu option is Hot dog. Display the option number followed by its description, as you did in Step e. Similarly, display the third option, Salad. Finally, display the fourth option, which is Exit. Each option should appear on its own line. Finally, on a new line, display a question mark (? ), followed by a space.this is where the user will type input to make a selection. In the next tutorial, you will learn how to read the user s response from the keyboard. g) Save your modified source code file. h) Compile the completed application. i) Running the completed application. Select Debug > Start Without Debugging to run your application. Compare the output of your completed Restaurant Survey application with the output shown in Fig to ensure that you wrote your application correctly. j) Close the Command Prompt window. 1 // Exercise 2. 2 // Create an application that displays a menu of options cout << "\nselect a menu option\n"; cout << "1 - Hamburger\n"; cout << "2 - Hot dog\n"; cout << "3 - Salad\n"; cout << " - Exit\n"; cout << "? \n\n"; 17 return 0 ; // indicate that program ended successfully } // end function main What does this code do? 2.1 What does the following code do? In particular, what does it display? 1 // Exercise 2.1: WDTCD.cpp 2 // What does this code do? 10 cout << "\n *\n ***\n*****\n ***\n *\n\n"; return 0 ; // indicate that program ended successfully 1 } // end function main

7 Tutorial 2 Welcome Application 7 Answer: The application displays a diamond. What s wrong with this code? 2.15 The following code segment should display a table listing an item for sale in the first column and the item s price in the second column (Fig.2.38). Figure 2.38 Correct application output. Find the error(s) in the following code: 1 // Exercise 2.15: WWWTC.cpp 2 // This application displays prices for certain items 10 cout << "Item\tPrice"; cout << "Hammer\t$10"; cout << "Nails\t$2"; cout << "Saw\t$15"; 1 15 return 0 ; // indicate that program ended successfully 1 17 } // end function main Answer: In the original code, the output statement is missing a newline escape sequence to allow the next item to be displayed on the next line.also, the first line of Fig indicates that there should be a blank line before the table is displayed. So, there is also a newline missing at the beginning of the corrected code is displayed below. Modified lines are highlighted. 1 // Exercise 2.15: WWWTC.cpp 2 // This application displays prices for certain items 3 // in a store #include <iostream> // required to perform C++ stream I/O 5 using namespace std; // for accessing C++ Standard Library members 7 8 // function main begins program execution 9 int main() 10 { cout << "\nitem\tprice\n";

8 8 Introduction to C++ Programming (Solutions) Tutorial cout << "Hammer\t$10\n"; cout << "Nails\t$2\n"; cout << "Saw\t$15\n\n"; 1 return 0 ; // indicate that program ended successfully } // end function main Programming Challenge 2.1 (Enhanced Welcome Application) The Welcome application you created in this tutorial displayed plain text. A series of symbols (such as asterisks) can be used to display simple graphics. In this application, you will modify the Welcome application to display a message containing a border, centered text and the word C++ displayed using asterisks (Fig.2.39). Figure 2.39 Enhanced Welcome application output. a) Copying the template to your working directory. Copy the directory C:\Examples\ Tutorial02\Exercises\EnhancedWelcome to your C:\SimplyCpp directory. If you are not using Visual Studio.NET, skip to Step c. b) Creating a new project. If you have not already done so, start Visual Studio.NET.To create a new project, select File > New > Project, causing the New Project dialog to display. Click the Visual C++ Projects folder in the Project Types: pane to display the list of Visual C++.NET project types in the Templates: pane. Select Win32 Console Project from the Templates: pane. In the Win32 Application Wizard, click the Application Settings link, select the Empty project check box, then click Finish. Name the project EnhancedWelcome. Save this project in your SimplyCpp directory. Then add the existing source code file, Welcome.cpp, which is located in the C:\SimplyCpp\EnhancedWelcome directory. c) Opening the template file. Open the Welcome.cpp file in your text editor or IDE. d) Creating the top border. The first line of output should be the top border for your text. In the template code, insert a cout statement that displays a newline, then 3 asterisks followed by a newline. e) Creating the second line of output. To create the left and right borders, each output line should begin and end with an asterisk. Also, each output line must be exactly 3 characters wide. The second line of output does not contain any text, so the line should output an asterisk, followed by 32 spaces, an asterisk and a newline escape sequence (in that order). f) Displaying Welcome to. To center the text Welcome to, display spaces after the first asterisk before displaying Welcome to. Remember to insert a newline at the end of every line you display. g) Displaying C++ Display a line containing only the left and right borders.then use the next seven lines of output to create the C++ out of asterisks, as shown in Fig Then, display a line containing only the left and right borders. Display the bottom border, which should appear exactly as the top border from Step d. Finally, display two newlines. h) Save your modified source code file.

9 Tutorial 2 Welcome Application 9 Answer: i) Compile the completed application. j) Running the completed application. Select Debug > Start Without Debugging to run your application. Compare the output of your completed Welcome application with the output shown in Fig to ensure that you wrote your application correctly. k) Close the Command Prompt window. l) Close your text editor or IDE. m)(optional) Using a single statement to display the welcome message.try displaying the entire welcome message using a single statement. Note that your statement may continue on multiple lines of source code when you use multiple stream insertion operators. 1 // Exercise // Create an application that displays a welcome message cout << "\n**********************************\n"; cout << "* *\n"; cout << "* Welcome to *\n"; cout << "* *\n"; cout << "* *** * *\n"; cout << "* * * * *\n"; cout << "* * * * * *\n"; cout << "* * *** *** * *\n"; cout << "* * * * * *\n"; cout << "* * * *\n"; cout << "* *** * *\n"; cout << "* *\n"; cout << "**********************************\n\n"; 2 return 0 ; // indicate that program ended successfully 25 2 } // end function main

Appendix M: Introduction to Microsoft Visual C Express Edition

Appendix M: Introduction to Microsoft Visual C Express Edition Appendix M: Introduction to Microsoft Visual C++ 2005 Express Edition This book may be ordered from Addison-Wesley in a value pack that includes Microsoft Visual C++ 2005 Express Edition. Visual C++ 2005

More information

Getting Started with Visual Studio

Getting Started with Visual Studio Getting Started with Visual Studio Visual Studio is a sophisticated but easy to use integrated development environment (IDE) for C++ (and may other languages!) You will see that this environment recognizes

More information

Introduction to Programming

Introduction to Programming Introduction to Programming session 5 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2010 These slides are created using Deitel s slides Sahrif University of Technology Outlines

More information

Chapter 1 Introduction to Computers and C++ Programming

Chapter 1 Introduction to Computers and C++ Programming Chapter 1 Introduction to Computers and C++ Programming 1 Outline 1.1 Introduction 1.2 What is a Computer? 1.3 Computer Organization 1.7 History of C and C++ 1.14 Basics of a Typical C++ Environment 1.20

More information

CS 241 Computer Programming. Introduction. Teacher Assistant. Hadeel Al-Ateeq

CS 241 Computer Programming. Introduction. Teacher Assistant. Hadeel Al-Ateeq CS 241 Computer Programming Introduction Teacher Assistant Hadeel Al-Ateeq 1 2 Course URL: http://241cs.wordpress.com/ Hadeel Al-Ateeq 3 Textbook HOW TO PROGRAM BY C++ DEITEL AND DEITEL, Seventh edition.

More information

Fundamentals of Programming Session 4

Fundamentals of Programming Session 4 Fundamentals of Programming Session 4 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2011 These slides are created using Deitel s slides, ( 1992-2010 by Pearson Education, Inc).

More information

Lab 4: Introduction to Programming

Lab 4: Introduction to Programming _ Unit 2: Programming in C++, pages 1 of 9 Department of Computer and Mathematical Sciences CS 1410 Intro to Computer Science with C++ 4 Lab 4: Introduction to Programming Objectives: The main objective

More information

Superior University. Department of Electrical Engineering CS-115. Computing Fundamentals. Experiment No.1

Superior University. Department of Electrical Engineering CS-115. Computing Fundamentals. Experiment No.1 Superior University Department of Electrical Engineering CS-115 Computing Fundamentals Experiment No.1 Introduction of Compiler, Comments, Program Structure, Input Output, Data Types and Arithmetic Operators

More information

Welcome Application. Introducing the Visual Studio.NET IDE. Objectives. Outline

Welcome Application. Introducing the Visual Studio.NET IDE. Objectives. Outline 2 T U T O R I A L Objectives In this tutorial, you will learn to: Navigate Visual Studio.NET s Start Page. Create a Visual Basic.NET solution. Use the IDE s menus and toolbars. Manipulate windows in the

More information

TREX Set-Up Guide: Creating a TREX Executable File for Windows

TREX Set-Up Guide: Creating a TREX Executable File for Windows TREX Set-Up Guide: Creating a TREX Executable File for Windows Prepared By: HDR 1 International Boulevard, 10 th Floor, Suite 1000 Mahwah, NJ 07495 May 13, 2013 Creating a TREX Executable File for Windows

More information

C: How to Program. Week /Mar/05

C: How to Program. Week /Mar/05 1 C: How to Program Week 2 2007/Mar/05 Chapter 2 - Introduction to C Programming 2 Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers

More information

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2005

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2005 CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2005 The process of creating a project with Microsoft Visual Studio 2005.Net is similar to the process in Visual

More information

Visual C++ Tutorial. For Introduction to Programming with C++ By Y. Daniel Liang

Visual C++ Tutorial. For Introduction to Programming with C++ By Y. Daniel Liang 1 Introduction Visual C++ Tutorial For Introduction to Programming with C++ By Y. Daniel Liang Visual C++ is a component of Microsoft Visual Studio 2012 for developing C++ programs. A free version named

More information

Lab # 02. Basic Elements of C++ _ Part1

Lab # 02. Basic Elements of C++ _ Part1 Lab # 02 Basic Elements of C++ _ Part1 Lab Objectives: After performing this lab, the students should be able to: Become familiar with the basic components of a C++ program, including functions, special

More information

Overview. - General Data Types - Categories of Words. - Define Before Use. - The Three S s. - End of Statement - My First Program

Overview. - General Data Types - Categories of Words. - Define Before Use. - The Three S s. - End of Statement - My First Program Overview - General Data Types - Categories of Words - The Three S s - Define Before Use - End of Statement - My First Program a description of data, defining a set of valid values and operations List of

More information

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2010

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2010 CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2010 The process of creating a project with Microsoft Visual Studio 2010.Net is similar to the process in Visual

More information

Chapter 2 - Introduction to C Programming

Chapter 2 - Introduction to C Programming Chapter 2 - Introduction to C Programming 2 Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers 2.4 Memory Concepts 2.5 Arithmetic

More information

Chapter 2, Part I Introduction to C Programming

Chapter 2, Part I Introduction to C Programming Chapter 2, Part I Introduction to C Programming C How to Program, 8/e, GE 2016 Pearson Education, Ltd. All rights reserved. 1 2016 Pearson Education, Ltd. All rights reserved. 2 2016 Pearson Education,

More information

Understanding main() function Input/Output Streams

Understanding main() function Input/Output Streams Understanding main() function Input/Output Streams Structure of a program // my first program in C++ #include int main () { cout

More information

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2003

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2003 CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2003 The process of creating a project with Microsoft Visual Studio 2003.Net is to some extend similar to the process

More information

MS Visual Studio.Net 2008 Tutorial

MS Visual Studio.Net 2008 Tutorial 1. Start Visual Studio as follows: MS Visual Studio.Net 2008 Tutorial 2. Once you have started Visual Studio you should see a screen similar to the following image: 3. Click the menu item File New Project...

More information

Your First C++ Program. September 1, 2010

Your First C++ Program. September 1, 2010 Your First C++ Program September 1, 2010 Your First C++ Program //*********************************************************** // File name: hello.cpp // Author: Bob Smith // Date: 09/01/2010 // Purpose:

More information

Introduction to C++ Programming. Adhi Harmoko S, M.Komp

Introduction to C++ Programming. Adhi Harmoko S, M.Komp Introduction to C++ Programming Adhi Harmoko S, M.Komp Machine Languages, Assembly Languages, and High-level Languages Three types of programming languages Machine languages Strings of numbers giving machine

More information

Introduction. Key features and lab exercises to familiarize new users to the Visual environment

Introduction. Key features and lab exercises to familiarize new users to the Visual environment Introduction Key features and lab exercises to familiarize new users to the Visual environment January 1999 CONTENTS KEY FEATURES... 3 Statement Completion Options 3 Auto List Members 3 Auto Type Info

More information

University of Technology. Laser & Optoelectronics Engineering Department. C++ Lab.

University of Technology. Laser & Optoelectronics Engineering Department. C++ Lab. University of Technology Laser & Optoelectronics Engineering Department C++ Lab. Fifth week Control Structures A program is usually not limited to a linear sequence of instructions. During its process

More information

4. Structure of a C++ program

4. Structure of a C++ program 4.1 Basic Structure 4. Structure of a C++ program The best way to learn a programming language is by writing programs. Typically, the first program beginners write is a program called "Hello World", which

More information

UEE1302 (1102) F10: Introduction to Computers and Programming

UEE1302 (1102) F10: Introduction to Computers and Programming Computational Intelligence on Automation Lab @ NCTU Learning Objectives UEE1302 (1102) F10: Introduction to Computers and Programming Programming Lecture 00 Programming by Example Introduction to C++ Origins,

More information

Chapter 1 An Introduction to C++, Unix, SSH and Komodo Edit

Chapter 1 An Introduction to C++, Unix, SSH and Komodo Edit Chapter 1 An Introduction to C++, Unix, SSH and Komodo Edit Contents 1 An Introduction to C++, Unix, SSH and Komodo Edit 1.1 Introduction 1.2 The C++ Language 1.2.1 A Brief Introduction 1.2.1.1 Recommended

More information

Introduction to C++ Programming Pearson Education, Inc. All rights reserved.

Introduction to C++ Programming Pearson Education, Inc. All rights reserved. 1 2 Introduction to C++ Programming 2 What s in a name? that which we call a rose By any other name would smell as sweet. William Shakespeare When faced with a decision, I always ask, What would be the

More information

IT 374 C# and Applications/ IT695 C# Data Structures

IT 374 C# and Applications/ IT695 C# Data Structures IT 374 C# and Applications/ IT695 C# Data Structures Module 2.1: Introduction to C# App Programming Xianrong (Shawn) Zheng Spring 2017 1 Outline Introduction Creating a Simple App String Interpolation

More information

download instant at Introduction to C++

download instant at  Introduction to C++ Introduction to C++ 2 Programming, Input/Output and Operators What s in a name? that which we call a rose By any other name would smell as sweet. William Shakespeare High thoughts must have high language.

More information

Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++

Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++ Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++ 0.1 Introduction This is a session to familiarize working with the Visual Studio development environment. It

More information

Chapter 1 & 2 Introduction to C Language

Chapter 1 & 2 Introduction to C Language 1 Chapter 1 & 2 Introduction to C Language Copyright 2007 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 1 & 2 - Introduction to C Language 2 Outline 1.1 The History

More information

2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program

2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Parts of a C++ Program Parts of a C++ Program // sample C++ program

More information

CHAPTER 1.2 INTRODUCTION TO C++ PROGRAMMING. Dr. Shady Yehia Elmashad

CHAPTER 1.2 INTRODUCTION TO C++ PROGRAMMING. Dr. Shady Yehia Elmashad CHAPTER 1.2 INTRODUCTION TO C++ PROGRAMMING Dr. Shady Yehia Elmashad Outline 1. Introduction to C++ Programming 2. Comment 3. Variables and Constants 4. Basic C++ Data Types 5. Simple Program: Printing

More information

Chapter 2: Basic Elements of C++

Chapter 2: Basic Elements of C++ 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 Discover how a program evaluates

More information

Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program

Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program Objectives Chapter 2: Basic Elements of C++ In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates

More information

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction Chapter 2: Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 1 Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers

More information

Chapter 1 An Introduction to C++, Unix, SSH and Komodo Edit

Chapter 1 An Introduction to C++, Unix, SSH and Komodo Edit Chapter 1 An Introduction to C++, Unix, SSH and Komodo Edit A portion of this lab is to be done during the scheduled lab time. The take-home programming assignment is to be turned in before the next lab;

More information

Fundamentals of Programming. Lecture 3: Introduction to C Programming

Fundamentals of Programming. Lecture 3: Introduction to C Programming Fundamentals of Programming Lecture 3: Introduction to C Programming Instructor: Fatemeh Zamani f_zamani@ce.sharif.edu Sharif University of Technology Computer Engineering Department Outline A Simple C

More information

2 nd Week Lecture Notes

2 nd Week Lecture Notes 2 nd Week Lecture Notes Scope of variables All the variables that we intend to use in a program must have been declared with its type specifier in an earlier point in the code, like we did in the previous

More information

Linux Tutorial #1. Introduction. Login to a remote Linux machine. Using vim to create and edit C++ programs

Linux Tutorial #1. Introduction. Login to a remote Linux machine. Using vim to create and edit C++ programs Linux Tutorial #1 Introduction The Linux operating system is now over 20 years old, and is widely used in industry and universities because it is fast, flexible and free. Because Linux is open source,

More information

WRITING CONSOLE APPLICATIONS IN C

WRITING CONSOLE APPLICATIONS IN C WRITING CONSOLE APPLICATIONS IN C with Visual Studio 2017 A brief step-by-step primer for ME30 Bryan Burlingame, San José State University The Visual Studio 2017 Community Edition is a free integrated

More information

EECE.2160: ECE Application Programming Spring 2018 Programming Assignment #1: A Simple C Program Due Monday, 1/29/18, 11:59:59 PM

EECE.2160: ECE Application Programming Spring 2018 Programming Assignment #1: A Simple C Program Due Monday, 1/29/18, 11:59:59 PM Spring 2018 Programming Assignment #1: A Simple C Program Due Monday, 1/29/18, 11:59:59 PM 1. Introduction This program simply tests your ability to write, compile, execute, and submit programs using the

More information

Tutorial 2: Compiling and Running C++ Source Code

Tutorial 2: Compiling and Running C++ Source Code Tutorial 2: Compiling and Running C++ Source Code 1. Log in to your UNIX account as you did during the first tutorial. 2. Click on the desktop with the left mouse button and consider the menu that appears

More information

Introduction to C Programming. Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan

Introduction to C Programming. Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan Introduction to C Programming Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan Outline Printing texts Adding 2 integers Comparing 2 integers C.E.,

More information

Objectives. In this chapter, you will:

Objectives. In this chapter, you will: Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates arithmetic expressions Learn about

More information

Chapter 1 - What s in a program?

Chapter 1 - What s in a program? Chapter 1 - What s in a program? I. Student Learning Outcomes (SLOs) a. You should be able to use Input-Process-Output charts to define basic processes in a programming module. b. You should be able to

More information

LOGO BASIC ELEMENTS OF A COMPUTER PROGRAM

LOGO BASIC ELEMENTS OF A COMPUTER PROGRAM LOGO BASIC ELEMENTS OF A COMPUTER PROGRAM Contents 1. Statements 2. C++ Program Structure 3. Programming process 4. Control Structure STATEMENTS ASSIGNMENT STATEMENTS Assignment statement Assigns a value

More information

Introduction to Java Applications

Introduction to Java Applications 2 Introduction to Java Applications OBJECTIVES In this chapter you will learn: To write simple Java applications. To use input and output statements. Java s primitive types. Basic memory concepts. To use

More information

Chapter 2 Basic Elements of C++

Chapter 2 Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 2-1 Chapter 2 Basic Elements of C++ At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion

More information

6.096 Introduction to C++ January (IAP) 2009

6.096 Introduction to C++ January (IAP) 2009 MIT OpenCourseWare http://ocw.mit.edu 6.096 Introduction to C++ January (IAP) 2009 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. Welcome to 6.096 Lecture

More information

download instant at Introduction to C++

download instant at  Introduction to C++ Introduction to C++ 2 Programming: Solutions What s in a name? that which we call a rose By any other name would smell as sweet. William Shakespeare When faced with a decision, I always ask, What would

More information

12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.

12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments. Java How to Program, 9/e Education, Inc. All Rights Reserved. } Java application programming } Use tools from the JDK to compile and run programs. } Videos at www.deitel.com/books/jhtp9/ Help you get started

More information

NetBeans Tutorial. For Introduction to Java Programming By Y. Daniel Liang. This tutorial applies to NetBeans 6, 7, or a higher version.

NetBeans Tutorial. For Introduction to Java Programming By Y. Daniel Liang. This tutorial applies to NetBeans 6, 7, or a higher version. NetBeans Tutorial For Introduction to Java Programming By Y. Daniel Liang This tutorial applies to NetBeans 6, 7, or a higher version. This supplement covers the following topics: Getting Started with

More information

Access Groups. Collect and Store. Text Currency Date/Time. Tables Fields Data Type. You Your Friend Your Parent. Unique information

Access Groups. Collect and Store. Text Currency Date/Time. Tables Fields Data Type. You Your Friend Your Parent. Unique information Tutorial A database is a computerized record keeping system used to collect, store, analyze and report electronic information for a variety of purposes. Microsoft Access is a database. There are three

More information

Introduction to C++ IT 1033: Fundamentals of Programming

Introduction to C++ IT 1033: Fundamentals of Programming 2 Introduction to C++ IT 1033: Fundamentals of Programming Budditha Hettige Department of Computer Science C++ C++ is a middle-level programming language Developed by Bjarne Stroustrup Starting in 1979

More information

My First Command-Line Program

My First Command-Line Program 1. Tutorial Overview My First Command-Line Program In this tutorial, you re going to create a very simple command-line application that runs in a window. Unlike a graphical user interface application where

More information

Lab 1: Introduction to C Programming. (Creating a program using the Microsoft developer Studio, Compiling and Linking)

Lab 1: Introduction to C Programming. (Creating a program using the Microsoft developer Studio, Compiling and Linking) Lab 1: Introduction to C Programming (Creating a program using the Microsoft developer Studio, Compiling and Linking) Learning Objectives 0. To become familiar with Microsoft Visual C++ 6.0 environment

More information

Programming with C++ as a Second Language

Programming with C++ as a Second Language Programming with C++ as a Second Language Week 2 Overview of C++ CSE/ICS 45C Patricia Lee, PhD Chapter 1 C++ Basics Copyright 2016 Pearson, Inc. All rights reserved. Learning Objectives Introduction to

More information

Programming I Laboratory - lesson 01

Programming I Laboratory - lesson 01 Programming I Laboratory - lesson 0 Introduction in C++ programming environment. The C++ program structure. Computer programs are composed of instructions and data. Instructions tell the computer to do

More information

Chapter 1 INTRODUCTION

Chapter 1 INTRODUCTION Chapter 1 INTRODUCTION A digital computer system consists of hardware and software: The hardware consists of the physical components of the system. The software is the collection of programs that a computer

More information

3. NetBeans IDE 6.0. Java. Fall 2009 Instructor: Dr. Masoud Yaghini

3. NetBeans IDE 6.0. Java. Fall 2009 Instructor: Dr. Masoud Yaghini 3. NetBeans IDE 6.0 Java Fall 2009 Instructor: Dr. Masoud Yaghini Outline Installing the NetBeans IDE First NetBeans IDE Project IDE Windows Source Editor Customizing the IDE References Installing the

More information

esignal Formula Script (EFS) Tutorial Series

esignal Formula Script (EFS) Tutorial Series esignal Formula Script (EFS) Tutorial Series INTRODUCTORY TUTORIAL 1 EFS Basics and Tools Summary: This tutorial introduces the available tools for EFS development. This tutorial also details the basic

More information

Programming - 1. Computer Science Department 011COMP-3 لغة البرمجة 1 لطالب كلية الحاسب اآللي ونظم المعلومات 011 عال- 3

Programming - 1. Computer Science Department 011COMP-3 لغة البرمجة 1 لطالب كلية الحاسب اآللي ونظم المعلومات 011 عال- 3 Programming - 1 Computer Science Department 011COMP-3 لغة البرمجة 1 011 عال- 3 لطالب كلية الحاسب اآللي ونظم المعلومات 1 1.1 Machine Language A computer programming language which has binary instructions

More information

Program Organization and Comments

Program Organization and Comments C / C++ PROGRAMMING Program Organization and Comments Copyright 2013 Dan McElroy Programming Organization The layout of a program should be fairly straight forward and simple. Although it may just look

More information

Chapter 2 C++ Fundamentals

Chapter 2 C++ Fundamentals Chapter 2 C++ Fundamentals 3rd Edition Computing Fundamentals with C++ Rick Mercer Franklin, Beedle & Associates Goals Reuse existing code in your programs with #include Obtain input data from the user

More information

Intro to Programming & C Why Program? 1.2 Computer Systems: Hardware and Software. Why Learn to Program?

Intro to Programming & C Why Program? 1.2 Computer Systems: Hardware and Software. Why Learn to Program? Intro to Programming & C++ Unit 1 Sections 1.1-4 and 2.1-10, 2.12-13, 2.15-17 CS 1428 Spring 2019 Jill Seaman 1.1 Why Program? Computer programmable machine designed to follow instructions Program a set

More information

IS 0020 Program Design and Software Tools

IS 0020 Program Design and Software Tools 1 IS 0020 Program Design and Software Tools Introduction to C++ Programming Spring 2005 Lecture 1 Jan 6, 2005 Course Information 2 Lecture: James B D Joshi Tuesdays/Thursdays: 1:00-2:15 PM Office Hours:

More information

Programming for Engineers Introduction to C

Programming for Engineers Introduction to C Programming for Engineers Introduction to C ICEN 200 Spring 2018 Prof. Dola Saha 1 Simple Program 2 Comments // Fig. 2.1: fig02_01.c // A first program in C begin with //, indicating that these two lines

More information

Chapter 2: Overview of C++

Chapter 2: Overview of C++ Chapter 2: Overview of C++ Problem Solving, Abstraction, and Design using C++ 6e by Frank L. Friedman and Elliot B. Koffman C++ Background Introduced by Bjarne Stroustrup of AT&T s Bell Laboratories in

More information

LAB 1: FAMILIARITY WITH NETBEANS IDE ENVIRONMENT

LAB 1: FAMILIARITY WITH NETBEANS IDE ENVIRONMENT Statement Purpose: The purpose of this Lab. is to familiarize student with the programming environment they will be going to using throughout this course. This Lab. introduces the basics of NetBeans IDE

More information

[Page 177 (continued)] a. if ( age >= 65 ); cout << "Age is greater than or equal to 65" << endl; else cout << "Age is less than 65 << endl";

[Page 177 (continued)] a. if ( age >= 65 ); cout << Age is greater than or equal to 65 << endl; else cout << Age is less than 65 << endl; Page 1 of 10 [Page 177 (continued)] Exercises 4.11 Identify and correct the error(s) in each of the following: a. if ( age >= 65 ); cout

More information

Programming in Microsoft Visual C++ Programming in Microsoft Visual C++

Programming in Microsoft Visual C++ Programming in Microsoft Visual C++ Programming in Microsoft Visual C++ INDEX Part I - Getting Started with Visual C++ 5 Section 1 - Introducing Visual C++ 5 Section 2 - Writing Simple C++ Programs Section 3 - Structures, Classes, and the

More information

Computer Programming : C++

Computer Programming : C++ The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2003 Muath i.alnabris Computer Programming : C++ Experiment #1 Basics Contents Structure of a program

More information

Eclipse Tutorial. For Introduction to Java Programming By Y. Daniel Liang

Eclipse Tutorial. For Introduction to Java Programming By Y. Daniel Liang Eclipse Tutorial For Introduction to Java Programming By Y. Daniel Liang This supplement covers the following topics: Getting Started with Eclipse Choosing a Perspective Creating a Project Creating a Java

More information

Getting Started (1.8.7) 9/2/2009

Getting Started (1.8.7) 9/2/2009 2 Getting Started For the examples in this section, Microsoft Windows and Java will be used. However, much of the information applies to other operating systems and supported languages for which you have

More information

Superior University. Department of Electrical Engineering CS-115. Computing Fundamentals. Experiment No.5. for loop and do-while loop

Superior University. Department of Electrical Engineering CS-115. Computing Fundamentals. Experiment No.5. for loop and do-while loop Superior University Department of Electrical Engineering CS-115 Computing Fundamentals Experiment No.5 for loop and do-while loop Prepared for By: Name: ID: Section: Semester: Total Marks: Obtained Marks:

More information

Access Groups. Collect and Store. Text Currency Date/Time. Tables Fields Data Type. You Your Friend Your Parent. Unique information

Access Groups. Collect and Store. Text Currency Date/Time. Tables Fields Data Type. You Your Friend Your Parent. Unique information Tutorial A database is a computerized record keeping system used to collect, store, analyze and report electronic information for a variety of purposes. Microsoft Access is a database. There are three

More information

Object Oriented Design

Object Oriented Design Object Oriented Design Lecture 2: Introduction to C++ Class and Object Objects are essentially reusable software components. There are date objects, time objects, audio objects, video objects, automobile

More information

Tutorial 13 Salary Survey Application: Introducing One- Dimensional Arrays

Tutorial 13 Salary Survey Application: Introducing One- Dimensional Arrays Tutorial 13 Salary Survey Application: Introducing One- Dimensional Arrays Outline 13.1 Test-Driving the Salary Survey Application 13.2 Introducing Arrays 13.3 Declaring and Initializing Arrays 13.4 Constructing

More information

Starting Out with C++: Early Objects, 9 th ed. (Gaddis, Walters & Muganda) Chapter 2 Introduction to C++ Chapter 2 Test 1 Key

Starting Out with C++: Early Objects, 9 th ed. (Gaddis, Walters & Muganda) Chapter 2 Introduction to C++ Chapter 2 Test 1 Key Starting Out with C++ Early Objects 9th Edition Gaddis TEST BANK Full clear download (no formatting errors) at: https://testbankreal.com/download/starting-c-early-objects-9thedition-gaddis-test-bank/ Starting

More information

This manual will explain how to do a mail merge in Cordell Connect, using the following Windows programs:

This manual will explain how to do a mail merge in Cordell Connect, using the following Windows programs: Section 10 Mail Merge Cordell Connect has very a useful mail merge function for letters and mailing labels. Mail merges can be performed using project, company or contact information. The data source for

More information

Full file at C How to Program, 6/e Multiple Choice Test Bank

Full file at   C How to Program, 6/e Multiple Choice Test Bank 2.1 Introduction 2.2 A Simple Program: Printing a Line of Text 2.1 Lines beginning with let the computer know that the rest of the line is a comment. (a) /* (b) ** (c) REM (d)

More information

CSE 101 Introduction to Computers Development / Tutorial / Lab Environment Setup

CSE 101 Introduction to Computers Development / Tutorial / Lab Environment Setup CSE 101 Introduction to Computers Development / Tutorial / Lab Environment Setup Purpose: The purpose of this lab is to setup software that you will be using throughout the term for learning about Python

More information

Introduction to C# Applications

Introduction to C# Applications 1 2 3 Introduction to C# Applications OBJECTIVES To write simple C# applications To write statements that input and output data to the screen. To declare and use data of various types. To write decision-making

More information

Enterprise Modernization for IBM System z:

Enterprise Modernization for IBM System z: Enterprise Modernization for IBM System z: Transform 3270 green screens to Web UI using Rational Host Access Transformation Services for Multiplatforms Extend a host application to the Web using System

More information

Using OpenGL & GLUT in Visual Studio.NET 2003

Using OpenGL & GLUT in Visual Studio.NET 2003 Using OpenGL & GLUT in Visual Studio.NET 2003 A Guide to Easier Graphics Programming By Jordan Bradford This guide will show you how to set up a Visual Studio OpenGL/GLUT project that will compile in both

More information

A A B U n i v e r s i t y

A A B U n i v e r s i t y A A B U n i v e r s i t y Faculty of Computer Sciences O b j e c t O r i e n t e d P r o g r a m m i n g Week 4: Introduction to Classes and Objects Asst. Prof. Dr. M entor Hamiti mentor.hamiti@universitetiaab.com

More information

RVDS 3.0 Introductory Tutorial

RVDS 3.0 Introductory Tutorial RVDS 3.0 Introductory Tutorial 338v00 RVDS 3.0 Introductory Tutorial 1 Introduction Aim This tutorial provides you with a basic introduction to the tools provided with the RealView Development Suite version

More information

Creating a new CDC policy using the Database Administration Console

Creating a new CDC policy using the Database Administration Console Creating a new CDC policy using the Database Administration Console When you start Progress Developer Studio for OpenEdge for the first time, you need to specify a workspace location. A workspace is a

More information

c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance.

c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance. 2.1 Introduction (No questions.) 2.2 A Simple Program: Printing a Line of Text 2.1 Which of the following must every C program have? (a) main (b) #include (c) /* (d) 2.2 Every statement in C

More information

Engr 123 Spring 2018 Notes on Visual Studio

Engr 123 Spring 2018 Notes on Visual Studio Engr 123 Spring 2018 Notes on Visual Studio We will be using Microsoft Visual Studio 2017 for all of the programming assignments in this class. Visual Studio is available on the campus network. For your

More information

Instructor. Mehmet Zeki COSKUN Assistant Professor at the Geodesy & Photogrammetry, Civil Eng. (212)

Instructor. Mehmet Zeki COSKUN Assistant Professor at the Geodesy & Photogrammetry, Civil Eng. (212) Instructor Mehmet Zeki COSKUN Assistant Professor at the Geodesy & Photogrammetry, Civil Eng. (212) 285-6573 coskunmeh@itu.edu.tr http://atlas.cc.itu.edu.tr/~coskun Address Consultation of Students: Monday

More information

Some (semi-)advanced tips for LibreOffice

Some (semi-)advanced tips for LibreOffice Some (semi-)advanced tips for LibreOffice by Andy Pepperdine Introduction We cover several tips on special things in Writer and Calc and anything else that turns up. Although I use LibreOffice, these should

More information

[ Getting Started with Analyzer, Interactive Reports, and Dashboards ] ]

[ Getting Started with Analyzer, Interactive Reports, and Dashboards ] ] Version 5.3 [ Getting Started with Analyzer, Interactive Reports, and Dashboards ] ] https://help.pentaho.com/draft_content/version_5.3 1/30 Copyright Page This document supports Pentaho Business Analytics

More information

C How to Program, 6/e by Pearson Education, Inc. All Rights Reserved.

C How to Program, 6/e by Pearson Education, Inc. All Rights Reserved. C How to Program, 6/e 1992-2010 by Pearson Education, Inc. 1992-2010 by Pearson Education, Inc. 1992-2010 by Pearson Education, Inc. This chapter serves as an introduction to the important topic of data

More information

A Guided Tour of Doc-To-Help

A Guided Tour of Doc-To-Help A Guided Tour of Doc-To-Help ii Table of Contents Table of Contents...ii A Guided Tour of Doc-To-Help... 1 Converting Projects to Doc-To-Help 2005... 1 Using Microsoft Word... 10 Using HTML Source Documents...

More information

HOW TO USE CODE::BLOCKS IDE FOR COMPUTER PROGRAMMING LABORATORY SESSIONS

HOW TO USE CODE::BLOCKS IDE FOR COMPUTER PROGRAMMING LABORATORY SESSIONS HOW TO USE CODE::BLOCKS IDE FOR COMPUTER PROGRAMMING LABORATORY SESSIONS INTRODUCTION A program written in a computer language, such as C/C++, is turned into executable using special translator software.

More information

Introductionto C++ Programming

Introductionto C++ Programming What s in a name? that which we call a rose By any other name would smell as sweet. William Shakespeare When faced with a decision, I always ask, What would be the most fun? Peggy Walker Take some more

More information