Free Essay

Programming Concepts Using C++ Lab 6

In: Computers and Technology

Submitted By atsparker97
Words 260
Pages 2
Lab 6
Short Answer 1. The difference between a module and a function is the module is a group of statements that exist within a program for the purpose of performing a specific task. You are writing its definition. A function is a special type of module and most commonly referred to library functions which a made for different programming languages. 2. The three characteristics of a function in a IPO chart are: function header, function body, return statement. 3. The real number’s fractional part in a conversion function that is used to convert a real number to an integer usually shows up as a type mismatch error. A integer variable cannot hold fractional values. It’s better to convert the result of the math expression to an integer and then assign that integer to the variable. 4. A substring is a string within a string. The substring function typically accepts three arguments: (1) a string that you want to extract a substring from (2) the beginning position of the substring, and (3) the ending position of the substring. 5. The stringToInteger function accepts a string as an argument, converts it to an Integer, and returns the Integer value. The stringToReal function works the same way, but it converts a string to a Real, and usually then gets stored in the realNumber variable. 6. IsInteger function determines whether a string can be converted to a Integer and the isReal function determines whether a string can be converted to a Real. They use If Then Else statements.

Programming Exercises
1.

2.…...

Similar Documents

Free Essay

Programming Using C++

...smaller brans are separated. C. Scratch (C1-C7) At this step, the processed “somolina” and bran in the reduction stage (R1-R4) will be processed again and only the white component of the wheat will be extracted. And the extract white flour will be sucked out by high pressure fan to the plant sifter. Each pipe have their own siever. Then the flour which has passed the eighteen seieves will be the final product. The amount of wheat that has to be sieved shall be controlled by the airlock, the airlock will play a great role by determining the amount of wheat that has to be passed and seived. The end product or ther desired flour will be transported into silo via convier and elevator. The rest of the component which is not changed into flour will be transported back to the reduction process to be reprocessed (R1-R7 and C1-C7) until the bran and flour is competly separated. The milling process will be as follows. convier elevator scorer convier counter grinder pipe plant sifter convier counter convier elevator convier silo 4. Packing section * The final process in producing flour is the packaging section. In the former packaging system, the factory used to pack 1,2,3, and 5 kilograms by standard polly poplin films and 5,10,25, and 50 kilograms using PPC packaging material,......

Words: 561 - Pages: 3

Free Essay

Concepts of Programming Language Solutions

...Instructor’s Solutions Manual to Concepts of Programming Languages Tenth Edition R.W. Sebesta ©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved. Preface Changes for the Tenth Edition T he goals, overall structure, and approach of this tenth edition of Concepts of Programming Languages remain the same as those of the nine earlier editions. The principal goals are to introduce the main constructs of contemporary programming languages and to provide the reader with the tools necessary for the critical evaluation of existing and future programming languages. A secondary goal is to prepare the reader for the study of compiler design, by providing an indepth discussion of programming language structures, presenting a formal method of describing syntax and introducing approaches to lexical and syntatic analysis. The tenth edition evolved from the ninth through several different kinds of changes. To maintain the currency of the material, some of the discussion of older programming languages has been removed. For example, the description of COBOL’s record operations was removed from Chapter 6 and that of Fortran’s Do statement was removed from Chapter 8. Likewise, the description of Ada’s generic subprograms was removed from Chapter 9 and the discussion of Ada’s asynchronous message passing was removed from Chapter 13. On the other hand, a section on closures, a section on calling subprograms indirectly, and a section on generic functions......

Words: 7025 - Pages: 29

Premium Essay

C++ Programming

... C++ PROGRAMMING: FROM PROBLEM ANALYSIS TO PROGRAM DESIGN FIFTH EDITION D.S. MALIK Australia  Brazil  Japan  Korea  Mexico  Singapore  Spain  United Kingdom  United States C++ Programming: From Problem Analysis to Program Design, Fifth Edition D.S. Malik Executive Editor: Marie Lee Acquisitions Editor: Amy Jollymore Senior Product Manager: Alyssa Pratt Editorial Assistant: Zina Kresin Content Project Manager: Matthew Hutchinson Art Director: Faith Brosnan Print Buyer: Julio Esperas Cover Designer: Roycroft Design/ www.roycroftdesign.com Cover Photo: ª Guntmar Fritz/Masterfile Proofreader: Green Pen QA Indexer: Elizabeth Cunningham Compositor: Integra ª 2011 Course Technology, Cengage Learning ALL RIGHTS RESERVED. No part of this work covered by the copyright herein may be reproduced, transmitted, stored or used in any form or by any means graphic, electronic, or mechanical, including but not limited to photocopying, recording, scanning, digitizing, taping, Web distribution, information networks, or information storage and retrieval systems, except as permitted under Section 107 or 108 of the 1976 United States Copyright Act, without the prior written permission of the publisher. For product information and technology assistance, contact us at Cengage Learning Customer & Sales Support, 1-800-354-9706 For permission to use material from this text or product, submit all requests online at www.cengage.com/permissions Further permissions questions can......

Words: 11776 - Pages: 48

Free Essay

Concepts of Programming Languages

... CONCEPTS OF PROGRAMMING LANGUAGES TENTH EDITION This page intentionally left blank CONCEPTS OF PROGRAMMING LANGUAGES TENTH EDITION R O B E RT W. S EB ES TA University of Colorado at Colorado Springs Boston Columbus Indianapolis New York San Francisco Upper Saddle River Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto Delhi Mexico City Sao Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo Vice President and Editorial Director, ECS: Marcia Horton Editor in Chief: Michael Hirsch Executive Editor: Matt Goldstein Editorial Assistant: Chelsea Kharakozova Vice President Marketing: Patrice Jones Marketing Manager: Yez Alayan Marketing Coordinator: Kathryn Ferranti Marketing Assistant: Emma Snider Vice President and Director of Production: Vince O’Brien Managing Editor: Jeff Holcomb Senior Production Project Manager: Marilyn Lloyd Manufacturing Manager: Nick Sklitsis Operations Specialist: Lisa McDowell Cover Designer: Anthony Gemmellaro Text Designer: Gillian Hall Cover Image: Mountain near Pisac, Peru; Photo by author Media Editor: Dan Sandin Full-Service Vendor: Laserwords Project Management: Gillian Hall Printer/Binder: Courier Westford Cover Printer: Lehigh-Phoenix Color This book was composed in InDesign. Basal font is Janson Text. Display font is ITC Franklin Gothic. Copyright © 2012, 2010, 2008, 2006, 2004 by Pearson Education, Inc., publishing as Addison-Wesley. All rights reserved. Manufactured in the United......

Words: 142253 - Pages: 570

Free Essay

C++ Programming

...C++ CIS328 Professor Vijayakumar Kumarasamy 06/18/2014 Classes Classes are an expanded concept of data structures: like data structures, they can contain data members, but they can also contain functions as members. Object An object is an instantiation of a class. In terms of variables, a class would be the type, and an object would be the variable. Abstraction Data abstraction refers to, providing only essential information to the outside world and hiding their background details, i.e., to represent the needed information in program without presenting the details. Data abstraction is a programming (and design) technique that relies on the separation of interface and implementation. Encapsulation Encapsulation is an Object Oriented Programming concept that binds together the data and functions that manipulate the data, and that keeps both safe from outside interference and misuse. Data encapsulation led to the important OOP concept of data hiding. Data encapsulation is a mechanism of bundling the data, and the functions that use them and data abstraction is a mechanism of exposing only the interfaces and hiding the implementation details from the user. Inheritance One of the most important concepts in object-oriented programming is that of inheritance. Inheritance allows us to define a class in terms of another class, which makes it easier to create and maintain an application. This also provides an opportunity to reuse the code functionality and fast......

Words: 1199 - Pages: 5

Free Essay

C Programming on Linux

...C Programming on Linux What You Need for This Project * A Kali Linux virtual machine. You could use other operating systems too, if they have a C compiler. Writing the hello.c Source Code In a Terminal window, execute this command: nano hello.c The nano editor opens. Type in the program shown below. #include <stdio.h> main() { printf("Hello World!\n"); } Save your file with Ctrl+X, Y, Enter. Compiling hello.c to Create the hello File In a Terminal window, execute these commands: gcc hello.c -o hello ./hello These commands compile the hello.c program, creating an executable machine language file named hello, and run the hello executable. You should see "Hello World!", as shown below. This program works, but it would be nicer if it greeted you by name, and if it put a couple of newline characters after the greeting to make it cleaner-looking. The next version, hello2, will add these features. Writing the hello2.c Source Code In a Terminal window, execute this command: nano hello2.c The nano editor opens. Type in the program shown below. #include <stdio.h> main() { char name[10]; printf("What is your name?"); scanf("%s", name); printf("Hi, %s\n\n", name); } ...

Words: 1293 - Pages: 6

Free Essay

C Programming

...16/15=1.066666667 15%16=10 16%15=1 3a. i = 3 % 4=yes, 3 3b. i = ( 989 – MAX,_ I) / 3=no 3c. i = 4 % 3=yes 3d. x = PI * -1.0 3e. i = 3 / - 4=no 3f. x = 3 / 4= yes, 0.75 3g. x = 3% ( 3 / 4)=no 4a. i = 7 % 3=yes, 1 4b. i = ( 989 - MAX_ I) / 7= no 4c. i = 3 % 7=yes, 3 4d. x = PI * 2.0=no 4e. i = 7/ - 3=no 4f. x = 7 / 3=yes, 2.3333333333 4g. x = 7 % ( 7 / 3)=no p.102 3. What is illegal about the following program fragment? %lf%lf 4. Stylistically, which of the following identifiers would be good choices for names of constant macros? G Part 2 A. Int V Int I Int R V=I*R B. Int Area Int length Int width Area=length*width C. Int Rseries Int R1 Int R2 Int R3 Rseries=R1+R2+R3 D. Int Rparallel Int R1 Int R2 Int R1 Int R2 Rparallel=R1*R2/(R1+R2) Part3 a. 15.0 b. 7.5 c. 5.0,10.0,5,10 d. 15.0 e. 0.51.0 f. 0,3 Part 4 The month day and year are inputed...

Words: 252 - Pages: 2

Premium Essay

C Programming

...function body with the declarations of its local variables, and the statements that determine what the function does. Chapter 3 Self-Check Exercises (p. 123) number 1a-d, 2a-e 4. 1a) root = u + v * pow(w,2) 1b) root = cube(x – y) 1c) loge=pow(x, y) 1d) absolute = (x*y) – (w/z) 2a) 20.0 2b) 17 2c) 22.0 2d) 3.0 Chapter 3, Review Questions (p. 167), numbers 3-6, 3. A function is executed after the function prototype in a source program. A function prototype and a function definition appear on separate lines in a source in a source program. 4. For a team of programmers working together on a large program, function subprograms make it easier to apportion tasks. They simplify programing tasks. Functions can be utilized more than once in a program. 5. Functions are more efficient for computer and programmer. When writing a new program the computer saves time when it doesn’t have to keep searching for the same function each time. The availability of a function be stored for later use benefits the programmer as well, because the programmer does not need to define how the function is expected to execute. Chapter 6, Self-Check Exercises (p. 319) number 1 1. The first two say that the value of 10 will be stored in the variable m, and the value 5 will be stored I the variable n. The next line stores the memory address of m and n in pointer p. This line is applying the unary address of and operator to the variable m which is stored in mp. This line is applying the......

Words: 599 - Pages: 3

Free Essay

C++ Programming

... ALGORITHM: STEP 1:  Start the program. STEP 2:  Declare the class name as fn with data members and member functions. STEP 3:  Read the choice from the user. STEP 4:  Choice=1 then go to the step 5. STEP 5:  The function area() to find area of circle with one integer argument. STEP 6:  Choice=2 then go to the step 7. STEP 7:  The function area() to find area of rectangle with two integer argument. STEP 8:  Choice=3 then go to the step 9. STEP 9:  The function area() to find area of triangle with three arguments, two as Integer and one as float. STEP 10: Choice=4 then stop the program. PROGRAM: #include #include #include #define pi 3.14 class fn {       public:         void area(int); //circle         void area(int,int); //rectangle         void area(float ,int,int);  //triangle };   void fn::area(int a) {       cout<<"Area of Circle:"<>ch;        switch(ch)      {               case 1:                 cout<<"Enter Radious of the Circle:";                 cin>>r;                 obj.area(r);                 break;               case 2:           ......

Words: 282 - Pages: 2

Free Essay

C Programming

...C PROGRAMMING Section 1. Topics: Functions Statements Input Output Variables Introduction The C programming language has been the most popular high level language used for engineering applications for the last 20 years. It shares many common structures with other procedural languages, such as Pascal, and can be used for general purpose programming of a PC. However, it is also particularly good for development of embedded application programs such as those found in phones, video recorders and so forth. The term procedural language refers to the fact that the language uses procedures to do particular tasks such as printing on the screen. In C these procedures are known as functions and are described below. What is so good about a language like C? The basic reason such languages were developed was to make it easier for humans to program computers. The alternative is the language of the computer, i.e., binary codes. Clearly such ‘low-level’ languages are not very appealing for humans, although sometimes necessary for detailed engineering work. (In fact C is often ‘mixed’ with such languages for engineering applications.) C uses words and symbols that are part of, or similar to, normal language. This makes it easier for programmers to develop code. The C code is converted to the machine code by a special program called a compiler. See note 1. But perhaps the most useful thing about such a language is that it provides the developer with a library of......

Words: 3795 - Pages: 16

Premium Essay

Introduction to C Programming

...ROM, designed to implement a function that had previously been provided in software. 5. Operating system: the collection of software that directs a computer's operations, controlling and scheduling the execution of other programs, and managing storage, input/output, and communication resources. 6. Application program: a program used for a particular application 7. Machine language: a coding system built into the hardware of a computer, requiring no translation before being run. 8. Binary: A system of numerical notation to the base 2, in which each place of a number, expressed as 0 or 1, corresponds to a power of 2 9. Main memory: program-addressable storage that is directly controlled by and generally contained in the CPU: except for cache storage, the fastest type of storage available to any computer system. 10. Control systems: is a device, or set of devices, that manages commands, directs or regulates the behavior of other devices or systems. 11. Embedded systems: is a computer system with a dedicated function within a larger mechanical or electrical system, often with real-time computing constraints. 12. Data type: A data type in a programming language is a set of data with values having predefined characteristics. 13. Algorithm: a set of rules for solving a problem in a finite number of steps, as for finding the greatest common divisor. 14. Compiler: a computer program that translates a program written in a high-level language into......

Words: 913 - Pages: 4

Premium Essay

Lab 6

...Unit 6 Lab 6.1: Pseudocode Learning Objectives and Outcomes Use Boolean variables and logical operators in computer programs. Use compound logical conditions. Required Setup and Tools Standard lab setup Lab Manual Lab Demo Media and Startup Files CD Recommended Procedures Complete Lab 6.1: Pseudocode from the lab manual. Deliverables Submit the following at the end of this lab activity: The completed inputOptions() module in pseudocode in Step 1 The completed displayProvider() module with a case structure in pseudocode in Step 2 The completed and workable algorithm with nested If-Else statements using logical operators in Step 3 Unit 6 Lab 6.2: Flowcharts Learning Objectives and Outcomes Use flowcharts and pseudocode to represent Boolean conditions. Use if-then, if-then-else, and case structures in a computer program. Use Boolean variables and logical operators in computer programs. Use compound logical conditions. Required Setup and Tools Standard lab setup Lab Manual Lab Demo Media and Startup Files CD Recommended Procedures Complete Lab 6.2: Flowcharts from the lab manual. Deliverables Submit the following at the end of this lab activity: Corrected variable declarations and initializations using Visio in Step 2 Corrected module calls using Visio in Step 3 Corrected inputOptions() module using Visio in Step 4 Corrected displayProvider() module with case labels and flow lines using Visio in Step 5 Corrected displayChoices() module with......

Words: 355 - Pages: 2

Premium Essay

Linear Programming-Using Solver in Excel

...Linear Programming: Using Solver in Excel Linear Programming was conceptually developed before World War II by the outstanding Russian mathematician A.N.Kolmogorov and gained its popularity ever since the development of Simplex method by George B. Dantzig in 1947. Linear programming deals with problems of maximizing or minimizing a linear function in the presence of linear equality and/or inequality constraints. In these problems, we find the optimal, or most efficient way of using limited resources to achieve the objective of the situation. Linear Programming enables users to model large and complex problems and solve in a short amount of time by the use of effective algorithm, hence it is a powerful and widely used tool in various fields such as science, industrial engineering, financial planning and management decision making. Nowadays, with the development of technology, most of the real world Linear Programming problems are solved by computer programs. Excel Solver is a popular one. We work through different examples to demonstrate the applications of linear Programming model and the use of Excel Solver for various decision making in operation and supply chain management. Components of Linear Programming model To solve the linear programming problems, we first need to formulate the mathematical description called a mathematical model to represent the situation. Linear programming model usually consists of the following components * Decision variables: These......

Words: 2395 - Pages: 10

Free Essay

C Programming

...Welcome to CS 241 Systems Programming at Illinois Robin Kravets Copyright ©: University of Illinois CS 241 Staff 1 The Team  Robin Kravets    TAs   Office: 3114 SC rhk@illinois.edu Wade Fagen, Farhana Ashraf, Hilfi Alkaff and Mainak Ghosh Discussion Sections   8 sessions (Thursdays 9, 10, 11, 12, 1, 2, 3, 4) All sections in SC 0220 Copyright ©: University of Illinois CS 241 Staff 2 News and Email  Announcements and discussions: Piazza  http://www.piazza.com/illinois/cs241     All class questions This is your one-stop help-line! Will get answer < 24 hours e-mail   cs241help-fa12@cs.illinois.edu Personal questions not postable on the news group Copyright ©: University of Illinois CS 241 Staff 3 The Textbook  Introduction to Systems Concepts and Systems Programming      University of Illinois Custom Edition Copyright © 2007 Pearson Custom Publishing ISBN 0-536-48928-9 Taken from:    Operating Systems: Internals and Design Principles, Fifth Edition, by William Stallings UNIX™ Systems Programming: Communication, Concurrency, and Threads, by Kay A. Robbins and Steven Robbins Computer Systems: A Programmer's Perspective, by Randal E. Bryant and David R. O'Hallaron Copyright ©: University of Illinois CS 241 Staff 4 Your CS 241 “Mission”  Come to class     Read textbook    20% 7:00 – 9:00 PM October 15th Final  3% 47% Longer MPs are worth a little more Midterm   Reading assignments posted on......

Words: 1748 - Pages: 7

Free Essay

C# Programming

...True or False (Circle T/F if you think the statement is true/false) (Each question worth 5 points) 1. In C#, a project is a set of files and a solution is a set of projects. T 2. Every object you create or use in C# programming has a specific type usually. When a method doesn’t return anything, there is no return type defined for the method. F 3. In C#, some of the objects, variables or constants don’t have a specific type. F 4. The continue statement skips the remaining statements in the loop (any loop) and transfers control to the test condition. T 5. A smaller type must be explicitly cast to a compatible larger type. F 6. Assume you declared a constant when you’re programming. Although it is called a “constant”, its value can be changed when the program is running. F 7. The members in class A that are marked by private are accessible to methods of class A and also to methods of classes derived from class A. F 8. In C#, when you declare a variable without initializing it, the system will initialize the variable to 0 automatically as VB does. F 9. The system will execute a mathematical formula from left to right; you don’t have to consider the issue of operator precedence in C#. F 10. Implicit casting sometimes runs the risk of data loss. F Multiple Choice questions: (Circle all that applies. If all of your choices are correct but you missed the other correct choices, you will receive......

Words: 390 - Pages: 2

Street Food Fighter Ep.6 | Research | 2 Stück SKF 608 2Z (8x22x7 mm) Kugellager Rillenkugellager (ZZ)