CS 2605 Lab 10 Spring 2008

Size: px
Start display at page:

Download "CS 2605 Lab 10 Spring 2008"

Transcription

1 Text Parsing and Indexing: A Minimal db Goal In this lab, you will explore basic text parsing in C++. Learning Objectives understanding how to use getline() to break down input data understanding the logical view of a file as a sequence of bytes, the notion of offsets within a file, and how to use tellg() and seekg() to find and use offsets understanding the concept of an in-memory index structure for a collection of records design of an appropriate interface for a simple index class Mini-FAQ C++ and Files Logically, a file on disk is just a sequence of bytes. (The physical reality is somewhat more complex, but that's not an issue as long as you're using a high-level library to deal with the file.) So, each byte in the file is located at a specific, unique offset from the beginning of the file, just as the cells of an array are located at specific, unique offsets from the beginning of the array: T h e e f f e c t o f d e r e f e n You've already been introduced to I/O using several of the stream classes in the Standard Library. In this lab we'll make use of some features you may not have encountered yet. Input file streams maintain an internal pointer, called the get pointer, which stores the offset of the next byte of the file which would be returned if you performed a read operation. The get pointer is automatically updated, as needed, when a stream operator or member function is called. There are also three member functions which allow the user to make good use of file offsets: tellg() Returns the current value of the get pointer (i.e., the file offset); the return type is streampos, which is an integer variant seekg(offset) Resets the get pointer to that value; if the value is negative or exceeds the offset of the last byte of the file, the behavior is undefined. seekg(offset, direction) Adjusts the get pointer according to the value of the direction parameter: beg sets the get pointer to offset cur increments the get pointer by offset end sets the get pointer to a location offset bytes before the end of the file If the resulting location is invalid, the effect is undefined. For the record, output streams have an internal put pointer, which is the offset at which the next byte would be written, and similar functions tellp() and seekp() that allow the user to manipulate the put pointer. However, we won't be making use of those during this lab. 1

2 When parsing formatted input, the getline() function is often very useful: getline(inputstream, targetstring, stopcharacter) Parses inputstream from the current position forward until the stopcharacter is found, or the end of the stream is reached, putting the intervening characters into the targetstring. If the stopcharacter is found, it is removed from the stream, but not added to targetstring. This provides a simple way to parse input that consists of string "tokens" that are separated by specified characters, like a tab-separated file exported from a spreadsheet program. getline() does not skip over leading whitespace. Note that getline() does suffer one serious limitation. Since it places the data into a string object, it cannot be used to read numeric data without performing extra steps to convert the data after reading it. You might also want to know about the input manipulator ws. You can use this to advance the get pointer of an input stream to the next non-whitespace character (without removing that character from the stream). For example: Now it's time to put some of this to work. cin >> ws; Part I: Finding record offsets Choose a driver for this part. Your task is to write a function that can parse a file of relatively simple records and return a list of the file offsets at which those records begin. There's no reason at this time to make this a class member function. Download the file db01.txt from the lab page. The file contains a small number of records like this: AC P00350 DE 6-phosphogluconate dehydrogenase, decarboxylating (EC ). OS Escherichia coli KW Gluconate utilization; Oxidoreductase; Pentose shunt; NADP; KW Complete proteome. CC -!- CATALYTIC ACTIVITY: 6-phospho-D-gluconate + NADP(+) = D-ribulose CC 5-phosphate + CO(2) + NADPH. CC -!- PATHWAY: Hexose monophosphate shunt. CC -!- SIMILARITY: Belongs to the 6-phosphogluconate dehydrogenase CC family. CC CC This SWISS-PROT entry is copyright. It is produced through a collaboration CC between the Swiss Institute of Bioinformatics and the EMBL outstation - CC the European Bioinformatics Institute. There are no restrictions on its CC use by non-profit institutions as long as its content is in no way CC modified and this statement is not removed. Usage by and for commercial CC entities requires a license agreement (See CC or send an to license@isb-sib.ch). CC SQ MSKQQIGVVG MAVMGRNLAL NIESRGYTVS IFNRSREKTE EVIAENPGKK LVPYYTVKEF... Each record consists of six (or less) sections and a record terminator "". Each line of a record begins with a twocharacter line code indicating which section of the file it belongs to. For our current purpose, you don't need to worry about the significance of those line codes. But, you do need to know that the only line codes are the ones shown in the sample above, and that a line code is always followed by one or more spaces. The record terminator is followed immediately by a newline character. You must implement a function that meets the following specification: 2

3 The function parses File, and returns a vector of unsigned int values which are the file offsets of the records in that file. Pre: File contains a sequence of records of the form described above. Returns: A vector containing the offsets of the protein records found, listed in the same order the records occur in the file. vector<unsigned int> findoffsets(ifstream& File); All that's required is that your solution conforms to this interface, and that it computes the correct solution. Remember that so far we don't care about the specific data that's contained in the records, just finding the appropriate file offsets. For the given sample data file, the correct offsets would be: Note: The data files are supplied in Unix format, which is what your installation of Cygwin and g++ should be configured for. Be careful to not mess that up. In particular, download the files by right-clicking and selecting Save Target or Save Link, and do not open the data files in Notepad or modify them in any way. The file offsets do depend on the file format, so if you change it then you'll get different results. Put your function in a separate cpp file, named PartI.cpp, and create an appropriate header file, named PartI.h. If you write helper functions include them in the same cpp file. Test your solution by writing a simple driver and using the supplied data file. This is pretty straightforward; be sure you refer to the FAQ at the beginning of the lab specification. When you're sure it's correct, zip up the header file and the cpp file containing your function, and any helper functions it uses, and submit that to the Curator under the heading Lab10PI. Each member of your group must make a submission. This part will be auto-graded. The maximum score is 100. Part II: Building an index of the records Switch drivers for this part. Determining the offsets of the records is just the first step to producing a useful index of the records. An index enables the user to specify the value of a key field within a record and obtain the location of the matching record (or records if the key value isn't unique). The records we're dealing with consist of a number of fields; the AC, or accession code, field is a unique identifier for a record, and you will begin the process of building an index of records using their accession codes as the key. This requires creating two classes. First, you need a class that encapsulates the indexing data for a record. The interface for this class is determined entirely by the types of data it will store. The generic approach would be to implement a templated class, and in fact there's already an appropriate one in the STL. On the other hand, there's also something to be said for creating a custom class for the specific problem at hand, in which case, you might implement something very like the following class: 3

4 class ACEntry { public: ACEntry(const std::string& AC, unsigned int Offset); std::string AC() const; unsigned int Offset() const; private: std::string mac; unsigned int moffset; }; You are not required to implement the class shown above; the user will not ever access objects of this type directly. However, you must implement some such class, and the index must store one of those objects for each protein record that was found in the data file, and at this point it's acceptable to store them in a vector. However, the vector doesn't provide an appropriate interface from the user's perspective. The user of an index expects to carry out transactions of the form: "here is an accession code, give me the file offset of the corresponding record". Notice that the user doesn't even need to (or want to) be aware of the type of object we've put into the vector. So, we need a new class to provide an interface that's appropriate to a user of an index. The following class declares a minimal interface for an index: class ACIndex { public: ACIndex(std::ifstream& File); unsigned int offsetof(const std::string& AC); private: up to you... }; Implement this class. The constructor takes a file stream, already opened on a file like the one described in Part I, parses it, and builds the list of accession code index entries. You should be able to recycle much of your code from Part I here. Put the class declaration and implementation in files named PartII.h and PartII.cpp. You should write a test driver and test your index, using the offsets found in Part I to verify your results. When you're sure it's correct, zip up the header file and the cpp file containing your solution, and submit that to the Curator under the heading Lab10PII. Each member of your group must make a submission. This part will be auto-graded. The maximum score is 500. Part III: Finding records by offset Switch drivers for this part. For this part, you'll implement a companion function to the one you implemented in Part I: The function parses File, and returns a string object containing the protein record data beginning at Offset. Pre: File contains a sequence of records of the form described above. Offset is the file offset of the first byte of a record in the file. Returns: A string containing the bytes of the specified record, exactly as they occur in the file (including newline characters). string findprotrecord(ifstream& File, unsigned int Offset); 4

5 Again, you should refer to the discussion at the beginning of the specification for useful C++ features. Since you know the offsets of the records in the given data file, you can easily test your solution. If you have a correct solution and you insert the returned string into an output stream, you should see precisely the same display of the requested record that you would see if you view the original file in a text editor. Put your function in a separate cpp file, named PartIII.cpp, and create an appropriate header file, named PartIII.h. If you write helper functions include them in the same cpp file. You should write a test driver and test your index, using the offsets found in Part I and the data file to verify your results. When you're sure it's correct, zip up the header file and the cpp file containing your solution, and submit that to the Curator under the heading Lab10PIII. Each member of your group must make a submission. This part will be auto-graded. The maximum score is 500. Part IV: Finding a field of a record Switch drivers for this part. The function above returns the entire record as a string object, but if we were to implement an application program to serve user queries about a collection of records, we would certainly want to be able to provide finetuned access to individual fields of a record. Your next task is to implement the following function: The function parses File, and returns a string object containing the SQ field of the protein record beginning at Offset. Pre: File contains a sequence of records of the form described above. Offset is the file offset of the first byte of a record in the file. Returns: A string containing the bytes of the SQ field, without the line code or the leading spaces (or the trailing newline). string findaasequence(ifstream& File, unsigned int Offset); There are at least two way to approach this. You could copy and modify your solution to Part III so that it returns only part of the protein record from the file. Or, you could call your solution to Part III and retrieve the entire record from the file into a string object, and then parse the string (using an istringstream) to extract the specified data. Either approach is acceptable. Put your function in a separate cpp file, named PartIV.cpp, and create an appropriate header file, named PartIV.h. If you write helper functions include them in the same cpp file. When you're sure it's correct, zip up the header file and the cpp file containing your solution, and submit that to the Curator under the heading Lab10PIV. Each member of your group must make a submission. This part will be auto-graded. The maximum score is 100. Backup Lab Work Before leaving the lab both you and your partner should backup your submitted lab work. It is your responsibility to be able to produce a copy of your work. The Curator server is reasonably reliable, and you can download your submissions from it, but it is always best to maintain your own backups. A USB key or ing yourself a copy of your submitted archive are good options. 5

Protein Sequence Database

Protein Sequence Database Protein Sequence Database A protein is a large molecule manufactured in the cell of a living organism to carry out essential functions within the cell. The primary structure of a protein is a sequence

More information

Multiple-Key Indexing

Multiple-Key Indexing Multiple-Key Indexing For this project you provide indexing capabilities for a simple database file. The database will consist of a sequence of logical records, of varying sizes (similar to the initial

More information

COP Programming Assignment #7

COP Programming Assignment #7 1 of 5 03/13/07 12:36 COP 3330 - Programming Assignment #7 Due: Mon, Nov 21 (revised) Objective: Upon completion of this program, you should gain experience with operator overloading, as well as further

More information

gcc o driver std=c99 -Wall driver.c everynth.c

gcc o driver std=c99 -Wall driver.c everynth.c C Programming The Basics This assignment consists of two parts. The first part focuses on implementing logical decisions and integer computations in C, using a C function, and also introduces some examples

More information

Pointer Casts and Data Accesses

Pointer Casts and Data Accesses C Programming Pointer Casts and Data Accesses For this assignment, you will implement a C function similar to printf(). While implementing the function you will encounter pointers, strings, and bit-wise

More information

Assignment 1: grid. Due November 20, 11:59 PM Introduction

Assignment 1: grid. Due November 20, 11:59 PM Introduction CS106L Fall 2008 Handout #19 November 5, 2008 Assignment 1: grid Due November 20, 11:59 PM Introduction The STL container classes encompass a wide selection of associative and sequence containers. However,

More information

Stream States. Formatted I/O

Stream States. Formatted I/O C++ Input and Output * the standard C++ library has a collection of classes that can be used for input and output * most of these classes are based on a stream abstraction, the input or output device is

More information

Here is a C function that will print a selected block of bytes from such a memory block, using an array-based view of the necessary logic:

Here is a C function that will print a selected block of bytes from such a memory block, using an array-based view of the necessary logic: Pointer Manipulations Pointer Casts and Data Accesses Viewing Memory The contents of a block of memory may be viewed as a collection of hex nybbles indicating the contents of the byte in the memory region;

More information

Accessing Data in Memory

Accessing Data in Memory Accessing Data in Memory You will implement a simple C function that parses a tangled list of binary records in memory, processing them nonsequentially, and produces a simple text report. The function

More information

Geographic Information System version 1.0

Geographic Information System version 1.0 Geographic Information System version 1.0 Geographic information systems organize information pertaining to geographic features and provide various kinds of access to the information. A geographic feature

More information

Geographic Information System

Geographic Information System Geographic Information System Geographic information systems organize information pertaining to geographic features and provide various kinds of access to the information. A geographic feature may possess

More information

COMP322 - Introduction to C++

COMP322 - Introduction to C++ COMP322 - Introduction to C++ Lecture 05 - I/O using the standard library, stl containers, stl algorithms Dan Pomerantz School of Computer Science 5 February 2013 Basic I/O in C++ Recall that in C, we

More information

static CS106L Spring 2009 Handout #21 May 12, 2009 Introduction

static CS106L Spring 2009 Handout #21 May 12, 2009 Introduction CS106L Spring 2009 Handout #21 May 12, 2009 static Introduction Most of the time, you'll design classes so that any two instances of that class are independent. That is, if you have two objects one and

More information

Assignment 5: MyString COP3330 Fall 2017

Assignment 5: MyString COP3330 Fall 2017 Assignment 5: MyString COP3330 Fall 2017 Due: Wednesday, November 15, 2017 at 11:59 PM Objective This assignment will provide experience in managing dynamic memory allocation inside a class as well as

More information

Random File Access. 1. Random File Access

Random File Access. 1. Random File Access Random File Access 1. Random File Access In sequential file access, the file is read or written sequentially from the beginning. In random file access, you can skip around to various points in the file

More information

CS 2604 Minor Project 1 Summer 2000

CS 2604 Minor Project 1 Summer 2000 RPN Calculator For this project, you will design and implement a simple integer calculator, which interprets reverse Polish notation (RPN) expressions. There is no graphical interface. Calculator input

More information

Jim Lambers ENERGY 211 / CME 211 Autumn Quarter Programming Project 2

Jim Lambers ENERGY 211 / CME 211 Autumn Quarter Programming Project 2 Jim Lambers ENERGY 211 / CME 211 Autumn Quarter 2007-08 Programming Project 2 This project is due at 11:59pm on Friday, October 17. 1 Introduction In this project, you will implement functions in order

More information

CS 1044 Program 6 Summer I dimension ??????

CS 1044 Program 6 Summer I dimension ?????? Managing a simple array: Validating Array Indices Most interesting programs deal with considerable amounts of data, and must store much, or all, of that data on one time. The simplest effective means for

More information

Quiz Start Time: 09:34 PM Time Left 82 sec(s)

Quiz Start Time: 09:34 PM Time Left 82 sec(s) Quiz Start Time: 09:34 PM Time Left 82 sec(s) Question # 1 of 10 ( Start time: 09:34:54 PM ) Total Marks: 1 While developing a program; should we think about the user interface? //handouts main reusability

More information

CS201 Latest Solved MCQs

CS201 Latest Solved MCQs Quiz Start Time: 09:34 PM Time Left 82 sec(s) Question # 1 of 10 ( Start time: 09:34:54 PM ) Total Marks: 1 While developing a program; should we think about the user interface? //handouts main reusability

More information

// Initially NULL, points to the dynamically allocated array of bytes. uint8_t *data;

// Initially NULL, points to the dynamically allocated array of bytes. uint8_t *data; Creating a Data Type in C Bytes For this assignment, you will use the struct mechanism in C to implement a data type that represents an array of bytes. This data structure could be used kind of like a

More information

File-Mate FormMagic.com File-Mate 1500 User Guide. User Guide

File-Mate FormMagic.com File-Mate 1500 User Guide. User Guide User Guide File-Mate 1500 FormMagic.com File-Mate 1500 User Guide User Guide User Guide - Version 7.5 Chapters Application Overview 1500 Form Printing Import and Export Install and Update Registration

More information

Introduction. Lecture 5 Files and Streams FILE * FILE *

Introduction. Lecture 5 Files and Streams FILE * FILE * Introduction Lecture Files and Streams C programs can store results & information permanently on disk using file handling functions These functions let you write either text or binary data to a file, and

More information

CS102: Variables and Expressions

CS102: Variables and Expressions CS102: Variables and Expressions The topic of variables is one of the most important in C or any other high-level programming language. We will start with a simple example: int x; printf("the value of

More information

Lecture 5 Files and Streams

Lecture 5 Files and Streams Lecture 5 Files and Streams Introduction C programs can store results & information permanently on disk using file handling functions These functions let you write either text or binary data to a file,

More information

1 of 8 3/28/2010 8:03 AM C++ Special Topics Home Class Info Links Lectures Newsgroup Assignmen This is a short review of special topics in C++ especially helpful for various assignments. These notes are

More information

Lab 0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio

Lab 0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio ECE2049 Embedded Computing in Engineering Design Lab 0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio In this lab, you will be introduced to the Code Composer Studio

More information

COSC 2P95 Lab 5 Object Orientation

COSC 2P95 Lab 5 Object Orientation COSC 2P95 Lab 5 Object Orientation For this lab, we'll be looking at Object Orientation in C++. This is just a cursory introduction; it's assumed that you both understand the lecture examples, and will

More information

CS 2604 Minor Project 1 DRAFT Fall 2000

CS 2604 Minor Project 1 DRAFT Fall 2000 RPN Calculator For this project, you will design and implement a simple integer calculator, which interprets reverse Polish notation (RPN) expressions. There is no graphical interface. Calculator input

More information

CS Final Exam Review Suggestions - Fall 2017

CS Final Exam Review Suggestions - Fall 2017 CS 111 - Final Exam Review Suggestions p. 1 CS 111 - Final Exam Review Suggestions - Fall 2017 last modified: 2016-12-09 You are responsible for material covered in class sessions, lab exercises, and homeworks;

More information

Streams - Object input and output in C++

Streams - Object input and output in C++ Streams - Object input and output in C++ Dr. Donald Davendra Ph.D. Department of Computing Science, FEI VSB-TU Ostrava Dr. Donald Davendra Ph.D. (Department of Computing Streams - Object Science, input

More information

CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011. MIDTERM EXAMINATION Spring 2010

CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011. MIDTERM EXAMINATION Spring 2010 CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011 Lectures 1-22 Moaaz Siddiq Asad Ali Latest Mcqs MIDTERM EXAMINATION Spring 2010 Question No: 1 ( Marks: 1 ) - Please

More information

This chapter introduces the notion of namespace. We also describe how to manage input and output with C++ commands via the terminal or files.

This chapter introduces the notion of namespace. We also describe how to manage input and output with C++ commands via the terminal or files. C++ PROGRAMMING LANGUAGE: NAMESPACE AND MANGEMENT OF INPUT/OUTPUT WITH C++. CAAM 519, CHAPTER 15 This chapter introduces the notion of namespace. We also describe how to manage input and output with C++

More information

struct _Rational { int64_t Top; // numerator int64_t Bottom; // denominator }; typedef struct _Rational Rational;

struct _Rational { int64_t Top; // numerator int64_t Bottom; // denominator }; typedef struct _Rational Rational; Creating a Data Type in C Rational Numbers For this assignment, you will use the struct mechanism in C to implement a data type that represents rational numbers. A set can be modeled using the C struct:

More information

Skill 1: Multiplying Polynomials

Skill 1: Multiplying Polynomials CS103 Spring 2018 Mathematical Prerequisites Although CS103 is primarily a math class, this course does not require any higher math as a prerequisite. The most advanced level of mathematics you'll need

More information

ECE 244 Programming Fundamentals Fall Lab Assignment #5: Binary Search Trees

ECE 244 Programming Fundamentals Fall Lab Assignment #5: Binary Search Trees ECE 244 Programming Fundamentals Fall 2012 1. Objectives Lab Assignment #5: Binary Search Trees The objectives of this assignment are to provide you with more practice on the use of the various C++ concepts/constructs

More information

Here is a C function that will print a selected block of bytes from such a memory block, using an array-based view of the necessary logic:

Here is a C function that will print a selected block of bytes from such a memory block, using an array-based view of the necessary logic: Pointer Manipulations Pointer Casts and Data Accesses Viewing Memory The contents of a block of memory may be viewed as a collection of hex nybbles indicating the contents of the byte in the memory region;

More information

In our first lecture on sets and set theory, we introduced a bunch of new symbols and terminology.

In our first lecture on sets and set theory, we introduced a bunch of new symbols and terminology. Guide to and Hi everybody! In our first lecture on sets and set theory, we introduced a bunch of new symbols and terminology. This guide focuses on two of those symbols: and. These symbols represent concepts

More information

Lab 7 Macros, Modules, Data Access Pages and Internet Summary Macros: How to Create and Run Modules vs. Macros 1. Jumping to Internet

Lab 7 Macros, Modules, Data Access Pages and Internet Summary Macros: How to Create and Run Modules vs. Macros 1. Jumping to Internet Lab 7 Macros, Modules, Data Access Pages and Internet Summary Macros: How to Create and Run Modules vs. Macros 1. Jumping to Internet 1. Macros 1.1 What is a macro? A macro is a set of one or more actions

More information

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit.

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit. Com S 227 Fall 2018 Miniassignment 1 40 points Due Date: Friday, October 12, 11:59 pm (midnight) Late deadline (25% penalty): Monday, October 15, 11:59 pm General information This assignment is to be done

More information

gcc o driver std=c99 -Wall driver.c bigmesa.c

gcc o driver std=c99 -Wall driver.c bigmesa.c C Programming Simple Array Processing This assignment consists of two parts. The first part focuses on array read accesses and computational logic. The second part focuses on array read/write access and

More information

HELPLINE. Dilwyn Jones

HELPLINE. Dilwyn Jones HELPLINE Dilwyn Jones Remember that you can send me your Helpline queries by email to helpline@quanta.org.uk, or by letter to the address inside the front cover. While we do our best to help, we obviously

More information

EE 422C HW 6 Multithreaded Programming

EE 422C HW 6 Multithreaded Programming EE 422C HW 6 Multithreaded Programming 100 Points Due: Monday 4/16/18 at 11:59pm Problem A certain theater plays one show each night. The theater has multiple box office outlets to sell tickets, and the

More information

The Stack, Free Store, and Global Namespace

The Stack, Free Store, and Global Namespace Pointers This tutorial is my attempt at clarifying pointers for anyone still confused about them. Pointers are notoriously hard to grasp, so I thought I'd take a shot at explaining them. The more information

More information

Introduction to Programming using C++

Introduction to Programming using C++ Introduction to Programming using C++ Lecture One: Getting Started Carl Gwilliam gwilliam@hep.ph.liv.ac.uk http://hep.ph.liv.ac.uk/~gwilliam/cppcourse Course Prerequisites What you should already know

More information

Creating a String Data Type in C

Creating a String Data Type in C C Programming Creating a String Data Type in C For this assignment, you will use the struct mechanism in C to implement a data type that models a character string: struct _String { char data; dynamically-allocated

More information

Chapter-12 DATA FILE HANDLING

Chapter-12 DATA FILE HANDLING Chapter-12 DATA FILE HANDLING Introduction: A file is a collection of related data stored in a particular area on the disk. Programs can be designed to perform the read and write operations on these files.

More information

CS 142 Style Guide Grading and Details

CS 142 Style Guide Grading and Details CS 142 Style Guide Grading and Details In the English language, there are many different ways to convey a message or idea: some ways are acceptable, whereas others are not. Similarly, there are acceptable

More information

Slide 1 Side Effects Duration: 00:00:53 Advance mode: Auto

Slide 1 Side Effects Duration: 00:00:53 Advance mode: Auto Side Effects The 5 numeric operators don't modify their operands Consider this example: int sum = num1 + num2; num1 and num2 are unchanged after this The variable sum is changed This change is called a

More information

CSCI 102 Fall 2010 Exam #1

CSCI 102 Fall 2010 Exam #1 Name: USC Username: CSCI 102 Fall 2010 Exam #1 Problems Problem #1 (14 points) Problem #2 (15 points) Problem #3 (20 points) Problem #4 (16 points) Problem #5 (35 points) Total (100 points) Problem 1 Short

More information

CS102: Standard I/O. %<flag(s)><width><precision><size>conversion-code

CS102: Standard I/O. %<flag(s)><width><precision><size>conversion-code CS102: Standard I/O Our next topic is standard input and standard output in C. The adjective "standard" when applied to "input" or "output" could be interpreted to mean "default". Typically, standard output

More information

Object Oriented Programming CS250

Object Oriented Programming CS250 Object Oriented Programming CS250 Abas Computer Science Dept, Faculty of Computers & Informatics, Zagazig University arabas@zu.edu.eg http://www.arsaliem.faculty.zu.edu.eg Object Oriented Programming Principles

More information

Linked Lists. What is a Linked List?

Linked Lists. What is a Linked List? Linked Lists Along with arrays, linked lists form the basis for pretty much every other data stucture out there. This makes learning and understand linked lists very important. They are also usually the

More information

Watch the video below to learn more about number formats in Excel. *Video removed from printing pages. Why use number formats?

Watch the video below to learn more about number formats in Excel. *Video removed from printing pages. Why use number formats? Excel 2016 Understanding Number Formats What are number formats? Whenever you're working with a spreadsheet, it's a good idea to use appropriate number formats for your data. Number formats tell your spreadsheet

More information

Where to Start? Looking at this naively, you'll need to. You'll need to do this for each line of input

Where to Start? Looking at this naively, you'll need to. You'll need to do this for each line of input Parsing Where to Start? Looking at this naively, you'll need to Setup Print prompt Read in user input Transform it to commands, files, and symbols Match to a pattern Execute command Print results Cleanup

More information

We'll dive right in with an example linked list. Our list will hold the values 1, 2, and 3.!

We'll dive right in with an example linked list. Our list will hold the values 1, 2, and 3.! Linked Lists Spring 2016 CS 107 Version I. Motivating Example We'll dive right in with an example linked list. Our list will hold the values 1, 2, and 3. Linked lists can easily grow and shrink. In that

More information

CSCI 200 Lab 1 Implementing and Testing Simple ADTs in Java

CSCI 200 Lab 1 Implementing and Testing Simple ADTs in Java CSCI 200 Lab 1 Implementing and Testing Simple ADTs in Java This lab is a review of creating programs in Java and an introduction to JUnit testing. You will complete the documentation of an interface file

More information

ClientManager. New business user guide. Creating a group. Do this first

ClientManager. New business user guide. Creating a group. Do this first ClientManager New business user guide Creating a group Do this first When you create a group, that record will always exist, even if you don't quote that group or if they don't purchase a Priority Health

More information

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit.

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit. Com S 227 Fall 2017 Miniassignment 1 50 points Due Date: Monday, October 16, 11:59 pm (midnight) Late deadline (25% penalty): Tuesday, October 17, 11:59 pm General information This assignment is to be

More information

Tips from the experts: How to waste a lot of time on this assignment

Tips from the experts: How to waste a lot of time on this assignment Com S 227 Spring 2018 Assignment 1 100 points Due Date: Friday, September 14, 11:59 pm (midnight) Late deadline (25% penalty): Monday, September 17, 11:59 pm General information This assignment is to be

More information

CS143 Handout 05 Summer 2011 June 22, 2011 Programming Project 1: Lexical Analysis

CS143 Handout 05 Summer 2011 June 22, 2011 Programming Project 1: Lexical Analysis CS143 Handout 05 Summer 2011 June 22, 2011 Programming Project 1: Lexical Analysis Handout written by Julie Zelenski with edits by Keith Schwarz. The Goal In the first programming project, you will get

More information

d2vbaref.doc Page 1 of 22 05/11/02 14:21

d2vbaref.doc Page 1 of 22 05/11/02 14:21 Database Design 2 1. VBA or Macros?... 2 1.1 Advantages of VBA:... 2 1.2 When to use macros... 3 1.3 From here...... 3 2. A simple event procedure... 4 2.1 The code explained... 4 2.2 How does the error

More information

Assignment 3: Distance COP3330 Fall 2017

Assignment 3: Distance COP3330 Fall 2017 Assignment 3: Distance COP3330 Fall 2017 Due: Monday, October 16, 2017 at 11:59 PM Objective This assignment will provide experience with basic operator overloading. Task Your task will be to create a

More information

Enrolling in the Apple Developer program

Enrolling in the Apple Developer program Enrolling in the Apple Developer program Due to recent revisions in Apple's release guidelines, there are a new set of requirements that must be met before your branded mobile app can be published to the

More information

Each line will contain a string ("even" or "odd"), followed by one or more spaces, followed by a nonnegative integer.

Each line will contain a string (even or odd), followed by one or more spaces, followed by a nonnegative integer. Decision-making in C Squeezing Digits out of an Integer Assignment For part of this assignment, you will use very basic C techniques to implement a C function to remove from a given nonnegative integer

More information

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit.

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit. Com S 227 Spring 2018 Miniassignment 1 40 points Due Date: Thursday, March 8, 11:59 pm (midnight) Late deadline (25% penalty): Friday, March 9, 11:59 pm General information This assignment is to be done

More information

What's New. Version 9.2 release. Campground Master Contents 1. Contents. A couple quick reminders:

What's New. Version 9.2 release. Campground Master Contents 1. Contents. A couple quick reminders: Campground Master Contents 1 Contents A couple quick reminders: Make Backups! It's so sad when we hear from someone whose computer has crashed and they have no backup of their data to restore from. It's

More information

I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++

I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++ No. of Printed Pages : 3 I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination 05723. June, 2015 BCS-031 : PROGRAMMING IN C ++ Time : 3 hours Maximum Marks : 100 (Weightage 75%)

More information

Pointer Accesses to Memory and Bitwise Manipulation

Pointer Accesses to Memory and Bitwise Manipulation C Programming Pointer Accesses to Memory and Bitwise Manipulation This assignment consists of two parts, the second extending the solution to the first. Q1 [80%] Accessing Data in Memory Here is a hexdump

More information

CS Programming In C

CS Programming In C CS 24000 - Programming In C Week Two: Basic C Program Organization and Data Types Zhiyuan Li Department of Computer Science Purdue University, USA 2 int main() { } return 0; The Simplest C Program C programs

More information

Creating a Survey on Google Drive

Creating a Survey on Google Drive Creating a Survey on Google Drive It's easy to create a survey instrument on Google Drive (formerly called Google Docs). It has some distinct advantages over other free web-based survey services, such

More information

CS Final Exam Review Suggestions - Spring 2014

CS Final Exam Review Suggestions - Spring 2014 CS 111 - Final Exam Review Suggestions p. 1 CS 111 - Final Exam Review Suggestions - Spring 2014 last modified: 2014-05-09 before lab You are responsible for material covered in class sessions, lab exercises,

More information

Genealogy Software. Table of Contents

Genealogy Software. Table of Contents Genealogy Software Table of Contents Genealogy Software Overview... 2 Best Genealogy Software of 2017... 4 Family Tree Maker Software Update Information... 4 1 Genealogy Software Overview GENEALOGY SOFTWARE

More information

Google Groups. Using, joining, creating, and sharing. content with groups. What's Google Groups? About Google Groups and Google Contacts

Google Groups. Using, joining, creating, and sharing. content with groups. What's Google Groups? About Google Groups and Google Contacts Google Groups Using, joining, creating, and sharing content with groups What's Google Groups? Google Groups is a feature of Google Apps that makes it easy to communicate and collaborate with groups of

More information

Streams in C++ Stream concept. Reference information. Stream type declarations

Streams in C++ Stream concept. Reference information. Stream type declarations Stream concept A stream represent a sequence of bytes arriving, being retrieved, being stored, or being sent, in order. A stream is continuos and offer sequential access to the data. Each byte can be read

More information

Assignment 2: Temperature Class

Assignment 2: Temperature Class Assigned: September 23, 2016 Due: October 03, 2016, 11:59:59pm Assignment 2: Temperature Class Purpose The purpose of this project is to provide you more practice with implementing classes. Here you will

More information

https://www.eskimo.com/~scs/cclass/notes/sx8.html

https://www.eskimo.com/~scs/cclass/notes/sx8.html 1 de 6 20-10-2015 10:41 Chapter 8: Strings Strings in C are represented by arrays of characters. The end of the string is marked with a special character, the null character, which is simply the character

More information

ECE2049 Embedded Computing in Engineering Design. Lab #0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio

ECE2049 Embedded Computing in Engineering Design. Lab #0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio ECE2049 Embedded Computing in Engineering Design Lab #0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio In this lab you will be introduced to the Code Composer Studio

More information

CTEC 1802 Embedded Programming Labs

CTEC 1802 Embedded Programming Labs CTEC 1802 Embedded Programming Labs This document is intended to get you started using the Arduino and our I/O board in the laboratory - and at home! Many of the lab sessions this year will involve 'embedded

More information

CS 215 Fundamentals of Programming II Spring 2018 Project 5

CS 215 Fundamentals of Programming II Spring 2018 Project 5 CS 215 Fundamentals of Programming II Spring 2018 Project 5 30 points Out: March 23, 2018 Due: April 9, 2018 (Monday) As explained in Project 3, a line editor is a text editor that operates on lines of

More information

COMP 3500 Introduction to Operating Systems Project 5 Virtual Memory Manager

COMP 3500 Introduction to Operating Systems Project 5 Virtual Memory Manager COMP 3500 Introduction to Operating Systems Project 5 Virtual Memory Manager Points Possible: 100 Submission via Canvas No collaboration among groups. Students in one group should NOT share any project

More information

Project 0 Getting Started: A Simple Media Manager Due: Friday, September 14, 2018, 11:59 PM

Project 0 Getting Started: A Simple Media Manager Due: Friday, September 14, 2018, 11:59 PM Project 0 Getting Started: A Simple Media Manager Due: Friday, September 14, 2018, 11:59 PM Notice: The project Corrections and Clarifications page posted on the course web site become part of the specifications

More information

Absolute C++ Walter Savitch

Absolute C++ Walter Savitch Absolute C++ sixth edition Walter Savitch Global edition This page intentionally left blank Absolute C++, Global Edition Cover Title Page Copyright Page Preface Acknowledgments Brief Contents Contents

More information

C++ Style Guide. 1.0 General. 2.0 Visual Layout. 3.0 Indentation and Whitespace

C++ Style Guide. 1.0 General. 2.0 Visual Layout. 3.0 Indentation and Whitespace C++ Style Guide 1.0 General The purpose of the style guide is not to restrict your programming, but rather to establish a consistent format for your programs. This will help you debug and maintain your

More information

Binary, Hexadecimal and Octal number system

Binary, Hexadecimal and Octal number system Binary, Hexadecimal and Octal number system Binary, hexadecimal, and octal refer to different number systems. The one that we typically use is called decimal. These number systems refer to the number of

More information

CS 2704 Project 1 Spring 2001

CS 2704 Project 1 Spring 2001 Robot Tank Simulation We've all seen various remote-controlled toys, from miniature racecars to artificial pets. For this project you will implement a simulated robotic tank. The tank will respond to simple

More information

// class variable that gives the path where my text files are public static final String path = "C:\\java\\sampledir\\PS10"

// class variable that gives the path where my text files are public static final String path = C:\\java\\sampledir\\PS10 Problem Set 10 Due: 4:30PM, Friday May 10, 2002 Problem 1. Files and hashing, preliminary question (30%) This problem focuses on the use of the hashcode() method, and touches on the tostring() and equals()

More information

Created by Julie Zelenski, with edits by Jerry Cain, Keith Schwarz, Marty Stepp, Chris Piech and others.

Created by Julie Zelenski, with edits by Jerry Cain, Keith Schwarz, Marty Stepp, Chris Piech and others. Assignment 5: PQueue Created by Julie Zelenski, with edits by Jerry Cain, Keith Schwarz, Marty Stepp, Chris Piech and others. NOVEMBER 7TH, 2016 This assignment focuses on implementing a priority queue

More information

CSE434 Computer Networks (FALL, 2009) Programming Assignment 3 Due: Wed, December 2, 2009

CSE434 Computer Networks (FALL, 2009) Programming Assignment 3 Due: Wed, December 2, 2009 CSE434 Computer Networks (FALL, 2009) Programming Assignment 3 Due: Wed, December 2, 2009 Submission Procedure: No late submissions will be accepted. Submit a softcopy before the class to su.kim.asu@gmail.com.

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

Assignment 4. Overview. Prof. Stewart Weiss. CSci 335 Software Design and Analysis III Assignment 4

Assignment 4. Overview. Prof. Stewart Weiss. CSci 335 Software Design and Analysis III Assignment 4 Overview This assignment combines several dierent data abstractions and algorithms that we have covered in class, including priority queues, on-line disjoint set operations, hashing, and sorting. The project

More information

Chapter 12: Advanced File Operations

Chapter 12: Advanced File Operations Chapter 12: Advanced File Operations 12.1 File Operations File Operations File: a set of data stored on a computer, often on a disk drive Programs can read from, write to files Used in many applications:

More information

RECORD. Published : License : None

RECORD. Published : License : None RECORD Published : 2011-03-12 License : None 1 Record Activity 1. Introduction 2. Starting Record 3. Somebody Should Set The Title For This Chapter! 4. Overview of Record 5. Audio 6. Taking Photos 7. Video

More information

And Even More and More C++ Fundamentals of Computer Science

And Even More and More C++ Fundamentals of Computer Science And Even More and More C++ Fundamentals of Computer Science Outline C++ Classes Friendship Inheritance Multiple Inheritance Polymorphism Virtual Members Abstract Base Classes File Input/Output Friendship

More information

Review&Preview 1/23/15, 4:08:07 PM 1. 3rd edition - standardized, and standard library allows programmer to start from a higher level

Review&Preview 1/23/15, 4:08:07 PM 1. 3rd edition - standardized, and standard library allows programmer to start from a higher level Review&Preview 1/23/15, 4:08:07 PM 1 Stroustrup: All four prefaces, Ch. 1. Then read "Tour" chapters 2, 3, 4 and 5 but skip 5.3 Concurrency. Watch for new C++11 usage. H: Using using. Stroustrup Introduction:

More information

Cpt S 122 Data Structures. Introduction to C++ Part II

Cpt S 122 Data Structures. Introduction to C++ Part II Cpt S 122 Data Structures Introduction to C++ Part II Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Topics Objectives Defining class with a member function

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

CS 2604 Minor Project 3 Movie Recommender System Fall Braveheart Braveheart. The Patriot

CS 2604 Minor Project 3 Movie Recommender System Fall Braveheart Braveheart. The Patriot Description If you have ever visited an e-commerce website such as Amazon.com, you have probably seen a message of the form people who bought this book, also bought these books along with a list of books

More information

Variables. Data Types.

Variables. Data Types. Variables. Data Types. The usefulness of the "Hello World" programs shown in the previous section is quite questionable. We had to write several lines of code, compile them, and then execute the resulting

More information

CS 1044 Program 2 Spring 2002

CS 1044 Program 2 Spring 2002 Simple Algebraic Calculations One of the first things you will learn about C++ is how to perform numerical computations. In this project, you are given an incomplete program (see the end of this specification),

More information