Deadline. Purpose. How to submit. Important notes. CS Homework 9. CS Homework 9 p :59 pm on Friday, April 7, 2017

Size: px
Start display at page:

Download "Deadline. Purpose. How to submit. Important notes. CS Homework 9. CS Homework 9 p :59 pm on Friday, April 7, 2017"

Transcription

1 CS Homework 9 p. 1 Deadline 11:59 pm on Friday, April 7, 2017 Purpose CS Homework 9 To give you an excuse to look at some newly-posted C++ templates that you might find to be useful, and to use the design recipe to design and implement C++ functions, including functions with the side-effect of printing to the screen using cout, and even including main functions. How to submit Each time you would like to submit your work: If your files are not already on nrs-labs, be sure to use sftp/winscp/filezilla to get them TO nrs-labs (ideally in a folder/directory named 111hw9). Then, if you are not already logged onto nrs-labs, then use PuTTY/ssh to do so, and use cd to change to the folder/directory where your homework files are -- for example, cd 111hw9 Use the ls command to make sure your desired.cpp and.h files are really there: ls Use ~st10/111submit to submit them, with a homework number of 9 Make sure that ~st10/111submit shows that it submitted ALL of your.cpp and.h files you were intending to submit! Important notes As always, start the homework problems early! Then you'll have time to me your.cpp and.h files along with the error message(s) if you run into an error you don't know how to handle. (OR -- you can me those error message(s) and let me know that you've submitted the related.cpp and.h files using ~st10/111submit, and I can look over your function's files that way in trying to answer your question.) Be sure to follow the course coding style discussed in class and demonstrated in posted examples. In particular, remember to indent as shown and demonstrated in posted examples. For some of these problems, you will not be using funct_play -- for some, you still can (and probably should). Even when no longer required, you may still use funct_play if you would like (keeping in mind its limitations for main and void functions!). When you are not using funct_play, note that you need to include all of the components shown in the given templates (for main functions, non-main functions, and.h files) on the public course web page, whether you actually use those templates or not. Remember that you can JUST compile any single C++ function on nrs-labs with the command: g++ -c filename.cpp

2 CS Homework 9 p. 2 (If all goes well, this doesn't print anything to the screen, but it does result in a file filename.o, ready to be linked and loaded with other files to create a C++ executable file.) Remember that you can compile, link, and load to create a C++ executable program on nrs-labs with the command: g++ main_filename.cpp other1.cpp other2.cpp... -o main_filename...being sure to include the.cpp files for ALL functions used in that program; Also, to help you write these g++ calls to compile, link, and load your C++ programs (to result in C++ executable programs), there is a little script compile-helper on nrs-labs that asks you to enter details about your program-to-be and then "builds" an appropriate g++ command, which it runs as well as prints out so you can gradually learn how to write these yourself. (NOTE: it assumes you have already written all of the.cpp and.h files for your program, and have transferred them all to your current working directory on nrs-labs.) You are, of course, still expected to follow the Design Recipe for all functions that you design/define, whether they are non-main or main functions. Remember, you will receive significant credit for the signature, purpose, header, and examples/tests portions of your functions. Typically you'll get at least half-credit for a correct signature, purpose, header, and examples/tests, even if your function body is not correct. (and, you'll lose at least half-credit if you omit these or do them poorly, even if your function body is correct). Problem 1 I have posted templates -- handy starting points -- for C++ main functions, C++ non-main functions, and.h files for C++ non-main functions; they are on the public course web site, in the References section, just after the link to the course syllabus. (I also put links to them along with this homework handout in "Homeworks and Handouts".) As a small warm-up -- let's give you an immediate reason to refer to these newly-posted templates! Make a file named 111hw9-1.txt (you can use nano for this on nrs-labs, or something like NotePad++/TextWrangler your computer and then copy it to nrs-labs using sftp/winscp/filezilla), and start this file with: your name the last modified date Then answer the following questions based on these posted templates, preceding each answer with the part that it is for (1 part a, 1 part b, etc.) 1 part a Look at the template for C++ main functions, in main-template.txt, and scroll down to the main function header and function body given in this template. What is main's function header in this template?

3 CS Homework 9 p. 3 1 part b Again look at the template for C++ main functions, in main-template.txt, and again scroll down to the main function header and function body given in this template. What C++ statement is the first statement inside the main function body in this template? 1 part c Again look at the template for C++ main functions, in main-template.txt, and again scroll down to the main function header and function body given in this template. What C++ statement is the last statement inside the main function body? 1 part d Now look at the template for C++ non-main functions, in non-main-function-template.txt. What word follows # in four of the lines, between the opening comment block and the function header? 1 part e Now look at the template for C++.h files (which you need for non-main functions, but usually not for main functions). What does this template note that you need to #include if your function has any parameters of type string or any named constants of type string? 1 part f Again look at the template for C++.h files. You'll see X_H in this template twice. What does the template tell you to replace those X's with? Problem 2 2 part a For some practice with cout, use funct_play to develop a function salutation that expects a name, has the side effect of printing to the screen a letter-style salutation including that name (and ending with a newline), and returns the length of the given name. (Remember, it is possible for a function to return something AND have a side-effect -- consider Week 10 Lecture 1's play_around and say_twice functions.) For example, salutation("ann") == 3 and has the side-effect of printing to the screen: Dear Ann, and salutation("charlie Brown") == 13 and has the side-effect of printing to the screen: Dear Charlie Brown, NOTE that, when you properly describe each example's side-effect, that will cause the main function being built for you in salutation_ck_expect.cpp to not compile! We'll fix this main function in salutation_ck_expect.cpp in 2 part b.

4 CS Homework 9 p. 4 2 part b Now, as mentioned, describing salutation's side-effect while writing salutation's examples/tests in funct_play caused funct_play to write bad-syntax cout statements in the main function in salutation_ck_expect.cpp. For example, if during funct_play you gave as an example: salutation("ann") == 3...and has the side-effect of printing to the screen: Dear Ann,...that causes funct_play to build these cout statements in salutation_ck_expect.cpp: cout << "(salutation(\"ann\") == 3): " << (salutation("ann") == 3) << endl; cout << "(...and has the side-effect of printing to the screen:): " << (...and has the side-effect of printing to the screen:) << endl; cout << "(Dear Ann): " << (Dear Ann) << endl; The first cout above is fine -- it outputs a char* literal and a function call result. The second two cout statements above are NOT OK, as they include bad syntax C++ expressions! SO, using nano, CHOP OUT the "bad" cout statements from salutation_ck_expect.cpp for each of your tests, and put a NEW cout statement before each of your tests that says what you SHOULD see when that test is run -- for example: cout << "should see a salutation for Ann, followed by a true test:" << endl; cout << "(salutation(\"ann\") == 3): " << (salutation("ann") == 3) << endl; SAVE your resulting salutation_ck_expect.cpp and re-compile EITHER using funct_compile OR by typing: g++ salutation_ck_expect.cpp salutation.cpp -o salutation_ck_expect Submit your resulting files salutation.cpp, salutation.h, and salutation_ck_expect.cpp. Problem 3 Consider Week 10 Lecture 2's main function in a file named hello.cpp: #include <cstdlib> #include <iostream> #include <string> #include <cmath> using namespace std; /*===== signature: main: void -> int purpose: expects nothing, and has the side-effect prints a greeting to the screen examples: when this is run, the following is printed to the screen:

5 CS Homework 9 p. 5 Hello, world! by: Sharon Tuttle last modified: =====*/ int main() { cout << "Hello, world!" << endl; } return EXIT_SUCCESS; You are now going to write a little main function, somewhat similar to this one, in a file named draw_pic.cpp. FUN FACT/REMINDER: To print a double quote (") or a backslash (\), you have to precede it with a backslash to "escape" its otherwise-special meaning. That is, cout << "moo\"moo\\moo" << endl; causes the following to be printed to the screen: moo"moo\moo With that said... Simply to practice with cout within a very simple main function, consider "ASCII art" -- drawing "pictures" with "plain" characters. For example, consider: XX or (very slightly modified from /\_/\ ( o o ) > ^ < meow! or (from \ / \o/ _/ \_ Write a main function in a file named draw_pic.cpp that simply prints to the screen a "hard-coded" ASCII art picture consisting of at least 4 lines of characters. ("Hard-coded" means it does the same thing every time -- it is not customizable, it can't be modified without modifying the program itself. The main function in hello.cpp could be said to be printing to the screen the "hard-coded" greeting Hello, world!) You may choose one of the shown examples, or come up with one of your own, or reproduce one you find on the web (IF you include the URL where you found it in a comment within your code -- credit your sources!).

6 CS Homework 9 p. 6 You can compile/link/load and create an executable for this program using the command: g++ draw_pic.cpp -o draw_pic (or you can try out compile-helper to walk you through this, if you would like!)...and, if you get no errors, you should be able to run the resulting program using the command: draw_pic Submit your resulting draw_pic.cpp. (NOTE: These might be posted on the course Moodle site for class perusal.) Problem 4 More typically, your main functions will call another function (or functions!) that you have written. NOTE that if your function RETURNS something you would like printed, you need to call it INSIDE a cout statement, so that the result the function RETURNS is printed to the screen: cout << sqrt(4) << endl; BUT, if your function has the side-effect of printing to the screen, and you JUST want that side-effect, and NOT what it returns, you can JUST call that function as if it were a statement...! next_sound("moo"); KEEPING THIS IN MIND,...either starting from the posted main template or from your main in draw_pic.cpp, develop a main function in a file salutation_play.cpp that simply calls salutation at least FOUR times, with at least FOUR different arguments. Some important reminders: what do you need to #include in salutation_play.cpp so that its main function can call salutation? be sure to modify the opening comment block based on what this main function is doing! remember that you can compile/link/load and create an executable for this program using the command: g++ salutation_play.cpp salutation.cpp -o salutation_play...and, if you get no errors, you should be able to run the resulting program using the command: salutation_play Submit your resulting salutation_play.cpp; (you already submitted salutation.cpp and salutation.h as part of Problem 2).

CS Homework 10 p. 1. CS Homework 10

CS Homework 10 p. 1. CS Homework 10 CS 111 - Homework 10 p. 1 Deadline 11:59 pm on Friday, December 2, 2016 How to submit Each time you would like to submit your work: CS 111 - Homework 10 If your files are not already on nrs-labs, be sure

More information

CS Homework 11 p. 1. CS Homework 11

CS Homework 11 p. 1. CS Homework 11 CS 111 - Homework 11 p. 1 Deadline 11:59 pm on Monday, May 2, 2016 How to submit Each time you would like to submit your work: CS 111 - Homework 11 If your files are not already on nrs-labs, be sure to

More information

CS Homework 11 p. 1. CS Homework 11

CS Homework 11 p. 1. CS Homework 11 CS 111 - Homework 11 p. 1 Deadline 11:59 pm on Friday, December 12, 2014 How to submit Each time you would like to submit your work: CS 111 - Homework 11 IF they are not already on nrs-labs, then transfer/save

More information

CS Homework 10 p. 1. CS Homework 10

CS Homework 10 p. 1. CS Homework 10 CS 131 - Homework 10 p. 1 Deadline: 5:00 pm on Friday, December 3 How to submit: CS 131 - Homework 10 When you are done with the following problems: make sure that your current working directory on nrs-labs

More information

Spring CS Homework 12 p. 1. CS Homework 12

Spring CS Homework 12 p. 1. CS Homework 12 Spring 2018 - CS 111 - Homework 12 p. 1 Deadline 11:59 pm on Friday, May 4, 2018 Purpose CS 111 - Homework 12 To practice with sentinel- and question-controlled loops, file input and file output, and writing

More information

Homework 11 Program Setup (with some IMPORTANT NEW STEPS!)

Homework 11 Program Setup (with some IMPORTANT NEW STEPS!) Spring 2018 - CS 111 - Homework 11 p. 1 Deadline 11:59 pm on Friday, April 27, 2018 Purpose To practice with loops, arrays, and more! How to submit CS 111 - Homework 11 Submit your main.cpp (or it may

More information

Spring CS Homework 6 p. 1. CS Homework 6

Spring CS Homework 6 p. 1. CS Homework 6 Spring 2018 - CS 111 - Homework 6 p. 1 Deadline 11:59 pm on Friday, March 9, 2018 Purpose CS 111 - Homework 6 To practice with some C++ basics, including following design recipe steps for designing and

More information

CS Fall Homework 11 p. 1. CS Homework 11

CS Fall Homework 11 p. 1. CS Homework 11 CS 111 - Fall 2018 - Homework 11 p. 1 Deadline 11:59 pm on MONDAY, December 3, 2018 Purpose To practice with loops, arrays, and more! How to submit Submit your THREE.cpp FILES: CS 111 - Homework 11 hw11.cpp

More information

Spring CS Homework 7 p. 1. CS Homework 7

Spring CS Homework 7 p. 1. CS Homework 7 Spring 2018 - CS 111 - Homework 7 p. 1 Deadline 11:59 pm on Friday, March 23, 2018 Purpose CS 111 - Homework 7 To practice with some C++ basics, including following design recipe steps for designing and

More information

CS Exam 2 Study Suggestions

CS Exam 2 Study Suggestions CS 131 - Fall 2009 p. 1 last modified: 11-10-09 CS 131 - * Remember: anything covered in lecture, in lab, or on a homework, is FAIR GAME. * You are responsible for all of the material covered through Week

More information

Spring CS Homework 3 p. 1. CS Homework 3

Spring CS Homework 3 p. 1. CS Homework 3 Spring 2018 - CS 111 - Homework 3 p. 1 Deadline 11:59 pm on Friday, February 9, 2018 Purpose CS 111 - Homework 3 To try out another testing function, check-within, to get more practice using the design

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

CS Week 14 Lab Exercise

CS Week 14 Lab Exercise CS 111 - Week 14 Lab Exercise p.1 Deadline CS 111 - Week 14 Lab Exercise - 2018-11-05 Due by the end of lab on 2018-11-26. (Submit whatever you have by the end of lab, even if incomplete.) How to submit

More information

CIS 130 Exam #2 Review Suggestions

CIS 130 Exam #2 Review Suggestions CIS 130 - Exam #2 Review Suggestions p. 1 * last modified: 11-11-05, 12:32 am CIS 130 Exam #2 Review Suggestions * remember: YOU ARE RESPONSIBLE for course reading, lectures/labs, and especially anything

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

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG 1 Notice Reading Assignment Chapter 1: Introduction to Java Programming Homework 1 It is due this coming Sunday

More information

CS Homework 2 p. 1. CS Homework 2

CS Homework 2 p. 1. CS Homework 2 CS 111 - Homework 2 p. 1 Deadline 11:59 pm on Friday, February 2, 2018 Purpose CS 111 - Homework 2 To practice defining and using named constants and check-expect expressions, and to practice using the

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

C++ For Science and Engineering Lecture 2

C++ For Science and Engineering Lecture 2 C++ For Science and Engineering Lecture 2 John Chrispell Tulane University Wednesday August 25, 2010 Basic Linux Commands Command ls pwd cd What it does. lists the files in the current directory prints

More information

Overloading Functions & Command Line Use in C++ CS 16: Solving Problems with Computers I Lecture #6

Overloading Functions & Command Line Use in C++ CS 16: Solving Problems with Computers I Lecture #6 Overloading Functions & Command Line Use in C++ CS 16: Solving Problems with Computers I Lecture #6 Ziad Matni Dept. of Computer Science, UCSB A reminder about Labs Announcements Please make sure you READ

More information

Spring CS Homework 2 p. 1. CS Homework 2. To practice with PL/SQL stored procedures and functions, and possibly exception handling.

Spring CS Homework 2 p. 1. CS Homework 2. To practice with PL/SQL stored procedures and functions, and possibly exception handling. Spring 2018 - CS 328 - Homework 2 p. 1 Deadline Due by 11:59 pm on Sunday, February 4, 2018. Purpose CS 328 - Homework 2 To practice with PL/SQL stored procedures and functions, and possibly exception

More information

Lab 1: First Steps in C++ - Eclipse

Lab 1: First Steps in C++ - Eclipse Lab 1: First Steps in C++ - Eclipse Step Zero: Select workspace 1. Upon launching eclipse, we are ask to chose a workspace: 2. We select a new workspace directory (e.g., C:\Courses ): 3. We accept the

More information

More Flow Control Functions in C++ CS 16: Solving Problems with Computers I Lecture #4

More Flow Control Functions in C++ CS 16: Solving Problems with Computers I Lecture #4 More Flow Control Functions in C++ CS 16: Solving Problems with Computers I Lecture #4 Ziad Matni Dept. of Computer Science, UCSB Administrative CHANGED T.A. OFFICE/OPEN LAB HOURS! Thursday, 10 AM 12 PM

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

Functions. CS111 Lab Queens College, CUNY Instructor: Kent Chin

Functions. CS111 Lab Queens College, CUNY Instructor: Kent Chin Functions CS111 Lab Queens College, CUNY Instructor: Kent Chin Functions They're everywhere! Input: x Function: f Output: f(x) Input: Sheets of Paper Function: Staple Output: Stapled Sheets of Paper C++

More information

Week 4 EECS 183 MAXIM ALEKSA. maximal.io

Week 4 EECS 183 MAXIM ALEKSA. maximal.io Week 4 EECS 183 MAXIM ALEKSA maximal.io Agenda Functions Scope Conditions Boolean Expressions Lab 2 Project 2 Q&A Lectures 15% 36% 19% 8:30am 10:00am with Bill Arthur 10:00am 11:30am with Mary Lou Dorf

More information

Exercise 1.1 Hello world

Exercise 1.1 Hello world Exercise 1.1 Hello world The goal of this exercise is to verify that computer and compiler setup are functioning correctly. To verify that your setup runs fine, compile and run the hello world example

More information

Week 2: Data and Output

Week 2: Data and Output CS 170 Java Programming 1 Week 2: Data and Output Learning to speak Java Types, Values and Variables Output Objects and Methods What s the Plan? Topic I: A little review IPO, hardware, software and Java

More information

Call-by-Type Functions in C++ Command-Line Arguments in C++ CS 16: Solving Problems with Computers I Lecture #5

Call-by-Type Functions in C++ Command-Line Arguments in C++ CS 16: Solving Problems with Computers I Lecture #5 Call-by-Type Functions in C++ Command-Line Arguments in C++ CS 16: Solving Problems with Computers I Lecture #5 Ziad Matni Dept. of Computer Science, UCSB Administrative CHANGED T.A. OFFICE/OPEN LAB HOURS!

More information

! A literal represents a constant value used in a. ! Numbers: 0, 34, , -1.8e12, etc. ! Characters: 'A', 'z', '!', '5', etc.

! A literal represents a constant value used in a. ! Numbers: 0, 34, , -1.8e12, etc. ! Characters: 'A', 'z', '!', '5', etc. Week 1: Introduction to C++ Gaddis: Chapter 2 (excluding 2.1, 2.11, 2.14) CS 1428 Fall 2014 Jill Seaman Literals A literal represents a constant value used in a program statement. Numbers: 0, 34, 3.14159,

More information

CS 132 Exam #1 - Study Suggestions

CS 132 Exam #1 - Study Suggestions CS 132 - Exam #1 Study Suggestions p. 1 * last modified: 2-16-05 CS 132 Exam #1 - Study Suggestions * The test covers through HW #3, the Week 5 Lab Exercise Exercise, and material through the 2-14-05 lecture/2-16-05

More information

Lab: Supplying Inputs to Programs

Lab: Supplying Inputs to Programs Steven Zeil May 25, 2013 Contents 1 Running the Program 2 2 Supplying Standard Input 4 3 Command Line Parameters 4 1 In this lab, we will look at some of the different ways that basic I/O information can

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

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

CS101 Linux Shell Handout

CS101 Linux Shell Handout CS101 Linux Shell Handout Introduction This handout is meant to be used as a quick reference to get a beginner level hands on experience to using Linux based systems. We prepared this handout assuming

More information

Discussion 1H Notes (Week 3, April 14) TA: Brian Choi Section Webpage:

Discussion 1H Notes (Week 3, April 14) TA: Brian Choi Section Webpage: Discussion 1H Notes (Week 3, April 14) TA: Brian Choi (schoi@cs.ucla.edu) Section Webpage: http://www.cs.ucla.edu/~schoi/cs31 More on Arithmetic Expressions The following two are equivalent:! x = x + 5;

More information

Slide 1 CS 170 Java Programming 1 The Switch Duration: 00:00:46 Advance mode: Auto

Slide 1 CS 170 Java Programming 1 The Switch Duration: 00:00:46 Advance mode: Auto CS 170 Java Programming 1 The Switch Slide 1 CS 170 Java Programming 1 The Switch Duration: 00:00:46 Menu-Style Code With ladder-style if-else else-if, you might sometimes find yourself writing menu-style

More information

CS Homework 7 p. 1. CS Homework 7. Problem 1 - START THIS A.S.A.P. (in case there are PROBLEMS...)

CS Homework 7 p. 1. CS Homework 7. Problem 1 - START THIS A.S.A.P. (in case there are PROBLEMS...) CS 328 - Homework 7 p. 1 Deadline Due by 11:59 pm on Sunday, March 27, 2016 How to submit CS 328 - Homework 7 Submit your files for this homework using ~st10/328submit on nrs-projects, with a hw number

More information

CS 31 Discussion 1A, Week 4. Zengwen Yuan (zyuan [at] cs.ucla.edu) Humanities A65, Friday 10:00 11:50 a.m.

CS 31 Discussion 1A, Week 4. Zengwen Yuan (zyuan [at] cs.ucla.edu) Humanities A65, Friday 10:00 11:50 a.m. CS 31 Discussion 1A, Week 4 Zengwen Yuan (zyuan [at] cs.ucla.edu) Humanities A65, Friday 10:00 11:50 a.m. Today s focus Notes from the project 2 grading Function call predefined function define a function

More information

More Examples Using Functions and Command-Line Arguments in C++ CS 16: Solving Problems with Computers I Lecture #6

More Examples Using Functions and Command-Line Arguments in C++ CS 16: Solving Problems with Computers I Lecture #6 More Examples Using Functions and Command-Line Arguments in C++ CS 16: Solving Problems with Computers I Lecture #6 Ziad Matni Dept. of Computer Science, UCSB Administrative CHANGED T.A. OFFICE/OPEN LAB

More information

Homework 09. Collecting Beepers

Homework 09. Collecting Beepers Homework 09 Collecting Beepers Goal In this lab assignment, you will be writing a simple Java program to create a robot object called karel. Your robot will start off in a world containing a series of

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

Welcome Back. CSCI 262 Data Structures. Hello, Let s Review. Hello, Let s Review. How to Review 1/9/ Review. Here s a simple C++ program:

Welcome Back. CSCI 262 Data Structures. Hello, Let s Review. Hello, Let s Review. How to Review 1/9/ Review. Here s a simple C++ program: Welcome Back CSCI 262 Data Structures 2 - Review What you learned in CSCI 261 (or equivalent): Variables Types Arrays Expressions Conditionals Branches & Loops Functions Recursion Classes & Objects Streams

More information

Unit 13. Linux Operating System Debugging Programs

Unit 13. Linux Operating System Debugging Programs 1 Unit 13 Linux Operating System Debugging Programs COMPILATION 2 3 Editors "Real" developers use editors designed for writing code No word processors!! You need a text editor to write your code Eclipse,

More information

CS31 Discussion 1E Spring 17 : week 05

CS31 Discussion 1E Spring 17 : week 05 CS31 Discussion 1E Spring 17 : week 05 TA: Bo-Jhang Ho bojhang@cs.ucla.edu Credit to former TA Chelsea Ju Road map of CS31 String Array Function Class Variable If / else Loops Pointer Today s Agenda }

More information

EECS 183, Week 5. General. Variables I/O. 0. At which location do you have to take the exam? 1. Source code vs. object code? 2. What s a library?

EECS 183, Week 5. General. Variables I/O. 0. At which location do you have to take the exam? 1. Source code vs. object code? 2. What s a library? EECS 183, Week 5 General 0. At which location do you have to take the exam? 1. Source code vs. object code? 2. What s a library? Variables 3. Name main data types in C++. 4. Is string a native data type

More information

CS 31 Discussion ABDULLAH-AL-ZUBAER IMRAN WEEK 6: C-STRINGS, STRUCT, CLASS AND PROJECT4

CS 31 Discussion ABDULLAH-AL-ZUBAER IMRAN WEEK 6: C-STRINGS, STRUCT, CLASS AND PROJECT4 CS 31 Discussion ABDULLAH-AL-ZUBAER IMRAN WEEK 6: C-STRINGS, STRUCT, CLASS AND PROJECT4 Recap Functions Parameter passing: pass by reference Strings Letter to digit and vice-versa Library functions: string

More information

Getting started with C++ (Part 2)

Getting started with C++ (Part 2) Getting started with C++ (Part 2) CS427: Elements of Software Engineering Lecture 2.2 11am, 16 Jan 2012 CS427 Getting started with C++ (Part 2) 1/22 Outline 1 Recall from last week... 2 Recall: Output

More information

Unit 10. Linux Operating System

Unit 10. Linux Operating System 1 Unit 10 Linux Operating System 2 Linux Based on the Unix operating system Developed as an open-source ("free") alternative by Linux Torvalds and several others starting in 1991 Originally only for Intel

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

Operator overloading

Operator overloading 1 Introduction 2 The copy constructor 3 Operator Overloading 4 Eg 1: Adding two vectors 5 The -> operator 6 The this pointer 7 Overloading = 8 Unary operators 9 Overloading for the matrix class 10 The

More information

CS Homework 6. Deadline. Purpose. How to submit. Important notes. Problem 1. Spring CS Homework 6 p. 1

CS Homework 6. Deadline. Purpose. How to submit. Important notes. Problem 1. Spring CS Homework 6 p. 1 Spring 2018 - CS 328 - Homework 6 p. 1 Deadline Due by 11:59 pm on Sunday, March 11, 2018. Purpose CS 328 - Homework 6 To encourage you to look over the course PHP style standards, and to give you more

More information

CS 31 Discussion 1A, Week 1. Zengwen Yuan (zyuan [at] cs.ucla.edu) Humanities A65, Friday 10:00 11:50

CS 31 Discussion 1A, Week 1. Zengwen Yuan (zyuan [at] cs.ucla.edu) Humanities A65, Friday 10:00 11:50 CS 31 Discussion 1A, Week 1 Zengwen Yuan (zyuan [at] cs.ucla.edu) Humanities A65, Friday 10:00 11:50 TA Zengwen Yuan ( zyuan [at] cs.ucla.edu ) Discussion session (1A): Humanities A65 Friday 10:00 11:50

More information

Review: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements

Review: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements Review: Exam 1 9/20/06 CS150 Introduction to Computer Science 1 1 Your First C++ Program 1 //*********************************************************** 2 // File name: hello.cpp 3 // Author: Shereen Khoja

More information

PIC 10A. Review for Midterm I

PIC 10A. Review for Midterm I PIC 10A Review for Midterm I Midterm I Friday, May 1, 2.00-2.50pm. Try to show up 5 min early so we can start on time. Exam will cover all material up to and including todays lecture. (Only topics that

More information

CS Homework 11

CS Homework 11 CS 328 - Homework 11 p. 1 Deadline CS 328 - Homework 11 Problem 4 (presenting something operational from Problem 3) is due during lab on Friday, April 29; the remainder of this homework is due by 11:59

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

CS1110 Lab 1 (Jan 27-28, 2015)

CS1110 Lab 1 (Jan 27-28, 2015) CS1110 Lab 1 (Jan 27-28, 2015) First Name: Last Name: NetID: Completing this lab assignment is very important and you must have a CS 1110 course consultant tell CMS that you did the work. (Correctness

More information

Spring CS Homework 8 p. 1. CS Homework 8

Spring CS Homework 8 p. 1. CS Homework 8 Spring 2018 - CS 328 - Homework 8 p. 1 Deadline Due by 11:59 pm on Sunday, April 1, 2018. Purpose CS 328 - Homework 8 To give you more practice with PHP and sessions, including using PHP and sessions to

More information

Lab 7 (50 pts) Due Sunday, May 20)

Lab 7 (50 pts) Due Sunday, May 20) Lab 7 (50 pts) Due Sunday, May 20) For this lab, you will be comparing sorting algorithms, specifically the speed of selection, insertion, quick, and merge sort on random, in-order, and reverse-order lists

More information

Welcome Back. CSCI 262 Data Structures. Hello, Let s Review. Hello, Let s Review. How to Review 8/19/ Review. Here s a simple C++ program:

Welcome Back. CSCI 262 Data Structures. Hello, Let s Review. Hello, Let s Review. How to Review 8/19/ Review. Here s a simple C++ program: Welcome Back CSCI 262 Data Structures 2 - Review What you learned in CSCI 261 (or equivalent): Variables Types Arrays Expressions Conditionals Branches & Loops Functions Recursion Classes & Objects Streams

More information

CS 106B Lecture 2: C++ Functions

CS 106B Lecture 2: C++ Functions CS 106B Lecture 2: C++ Functions parameters Wednesday, September 28, 2016 Programming Abstractions Fall 2016 Stanford University Computer Science Department Lecturer: Chris Gregg reading: Programming Abstractions

More information

Introduction to C ++

Introduction to C ++ Introduction to C ++ Thomas Branch tcb06@ic.ac.uk Imperial College Software Society October 18, 2012 1 / 48 Buy Software Soc. s Free Membership at https://www.imperialcollegeunion.org/shop/ club-society-project-products/software-products/436/

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

CSc Introduction to Computing

CSc Introduction to Computing CSc 10200 Introduction to Computing Lecture 2 Edgardo Molina Fall 2011 - City College of New York Thursday, September 1, 2011 Introduction to C++ Modular program: A program consisting of interrelated segments

More information

Introduction to Unix

Introduction to Unix Part 2: Looking into a file Introduction to Unix Now we want to see how the files are structured. Let's look into one. more $ more fe_03_06596.txt 0.59 1.92 A-f: hello 1.96 2.97 B-m: (( hello )) 2.95 3.98

More information

Chapter 2. Editing And Compiling

Chapter 2. Editing And Compiling Chapter 2. Editing And Compiling Now that the main concepts of programming have been explained, it's time to actually do some programming. In order for you to "edit" and "compile" a program, you'll need

More information

CS Software Engineering for Scientific Computing. Lecture 5: More C++, more tools.

CS Software Engineering for Scientific Computing. Lecture 5: More C++, more tools. CS 294-73 Software Engineering for Scientific Computing Lecture 5: More C++, more tools. Let s go back to our build of mdarraymain.cpp clang++ -DDIM=2 -std=c++11 -g mdarraymain.cpp DBox.cpp -o mdarraytest.exe

More information

CS Homework 2 p. 1. CS Homework 2

CS Homework 2 p. 1. CS Homework 2 CS 325 - Homework 2 p. 1 Deadline CS 325 - Homework 2 Problem 1 -- answering reading questions on Canvas for Reading Packet 1 -- must be completed by 10:45 am on Tuesday, September 5. Problem 2 -- answering

More information

Computer Science II Lecture 1 Introduction and Background

Computer Science II Lecture 1 Introduction and Background Computer Science II Lecture 1 Introduction and Background Discussion of Syllabus Instructor, TAs, office hours Course web site, http://www.cs.rpi.edu/courses/fall04/cs2, will be up soon Course emphasis,

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

BCIS 3630 Dr. GUYNES SPRING 2018 TUESDAY SECTION [JAN version] GRADER COURSE WEBSITE

BCIS 3630 Dr. GUYNES SPRING 2018 TUESDAY SECTION [JAN version] GRADER   COURSE WEBSITE COURSE WEBSITE http://www.steveguynes.com/bcis3630/bcis3630/default.html Instructor: Dr. Guynes Office: BLB 312H Phone: (940) 565-3110 Office Hours: By Email Email: steve.guynes@unt.edu TEXTBOOK: Starting

More information

PIC 10A Objects/Classes

PIC 10A Objects/Classes PIC 10A Objects/Classes Ernest Ryu UCLA Mathematics Last edited: November 13, 2017 User-defined types In C++, we can define our own custom types. Object is synonymous to variable, and class is synonymous

More information

Slide 1 CS 170 Java Programming 1

Slide 1 CS 170 Java Programming 1 CS 170 Java Programming 1 Objects and Methods Performing Actions and Using Object Methods Slide 1 CS 170 Java Programming 1 Objects and Methods Duration: 00:01:14 Hi Folks. This is the CS 170, Java Programming

More information

CS 11 C++ track: lecture 1

CS 11 C++ track: lecture 1 CS 11 C++ track: lecture 1 Administrivia Need a CS cluster account http://www.cs.caltech.edu/cgi-bin/ sysadmin/account_request.cgi Need to know UNIX (Linux) www.its.caltech.edu/its/facilities/labsclusters/

More information

CS Fall Homework 5 p. 1. CS Homework 5

CS Fall Homework 5 p. 1. CS Homework 5 CS 235 - Fall 2015 - Homework 5 p. 1 Deadline: CS 235 - Homework 5 Due by 11:59 pm on Wednesday, September 30, 2015. How to submit: Submit your files using ~st10/235submit on nrs-projects, with a homework

More information

Lecture 2 Tao Wang 1

Lecture 2 Tao Wang 1 Lecture 2 Tao Wang 1 Objectives In this chapter, you will learn about: Modular programs Programming style Data types Arithmetic operations Variables and declaration statements Common programming errors

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

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

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 10: OCT. 6TH INSTRUCTOR: JIAYIN WANG

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 10: OCT. 6TH INSTRUCTOR: JIAYIN WANG CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 10: OCT. 6TH INSTRUCTOR: JIAYIN WANG 1 Notice Assignments Reading Assignment: Chapter 3: Introduction to Parameters and Objects The Class 10 Exercise

More information

CS Homework 2. Deadline. How to submit. Purpose. Initial set of CS 328 PL/SQL and SQL coding standards

CS Homework 2. Deadline. How to submit. Purpose. Initial set of CS 328 PL/SQL and SQL coding standards CS 328 - Homework 2 p. 1 Deadline Due by 11:59 pm on Friday, February 6, 2015. How to submit CS 328 - Homework 2 Submit your files for this homework using ~st10/328submit on nrs-projects, with a homework

More information

EECS 183. Week 3 - Diana Gage. www-personal.umich.edu/ ~drgage

EECS 183. Week 3 - Diana Gage. www-personal.umich.edu/ ~drgage EECS 183 Week 3 - Diana Gage www-personal.umich.edu/ ~drgage Upcoming Deadlines Lab 3 and Assignment 3 due October 2 nd (this Friday) Project 2 will be due October 6 th (a week from Friday) Get started

More information

These are notes for the third lecture; if statements and loops.

These are notes for the third lecture; if statements and loops. These are notes for the third lecture; if statements and loops. 1 Yeah, this is going to be the second slide in a lot of lectures. 2 - Dominant language for desktop application development - Most modern

More information

Eat (we provide) link. Eater. Goal: Eater(Self) == Self()

Eat (we provide) link. Eater. Goal: Eater(Self) == Self() 15-251: Great Theoretical Ideas Guru: Yinmeng Zhang Assignment 12 Due: December 6, 2005 1 Reading Comprehension (0 points) Read the accompanying handout containing Ken Thompson s Turing Award Lecture,

More information

C++ Support Classes (Data and Variables)

C++ Support Classes (Data and Variables) C++ Support Classes (Data and Variables) School of Mathematics 2018 Today s lecture Topics: Computers and Programs; Syntax and Structure of a Program; Data and Variables; Aims: Understand the idea of programming

More information

CS 463 Project 1 Imperative/OOP Fractals

CS 463 Project 1 Imperative/OOP Fractals CS 463 Project 1 Imperative/OOP Fractals The goal of a couple of our projects is to compare a simple project across different programming paradigms. This semester, we will calculate the Mandelbrot Set

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

1) Log on to the computer using your PU net ID and password.

1) Log on to the computer using your PU net ID and password. CS 150 Lab Logging on: 1) Log on to the computer using your PU net ID and password. Connecting to Winter: Winter is the computer science server where all your work will be stored. Remember, after you log

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 80 points Due Date: Friday, February 2, 11:59 pm (midnight) Late deadline (25% penalty): Monday, February 5, 11:59 pm General information This assignment is to be done

More information

CS Homework 1 p. 1. CS Homework 1

CS Homework 1 p. 1. CS Homework 1 CS 335 - Homework 1 p. 1 Deadline: CS 335 - Homework 1 IF turned in on-paper: 11:59 am on Friday, February 4 IF submitted electronically: 11:59 pm on Friday, February 4 How to submit: Because of the nature

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

CS Homework 8 p. 1. CS Homework 8

CS Homework 8 p. 1. CS Homework 8 CS 325 - Homework 8 p. 1 Deadline: 11:59 pm on Friday, October 27, 2017 Purpose: CS 325 - Homework 8 To practice normalizing sets of relations into 1NF, 2NF, and 3NF, to practice writing more nested selects/subselects,

More information

CS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM

CS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM CS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM Objectives Defining a wellformed method to check class invariants Using assert statements to check preconditions,

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

Programming. Computer. Program. Programming Language. Execute sequence of simple (primitive) instructions What instructions should be provided?

Programming. Computer. Program. Programming Language. Execute sequence of simple (primitive) instructions What instructions should be provided? C++ Basics Programming Computer Execute sequence of simple (primitive) instructions What instructions should be provided? Is there a minimum set? (See Turing Machine) Generic Reduce future limitations

More information

Com S 227 Spring 2018 Assignment points Due Date: Thursday, September 27, 11:59 pm (midnight) "Late" deadline: Friday, September 28, 11:59 pm

Com S 227 Spring 2018 Assignment points Due Date: Thursday, September 27, 11:59 pm (midnight) Late deadline: Friday, September 28, 11:59 pm Com S 227 Spring 2018 Assignment 2 200 points Due Date: Thursday, September 27, 11:59 pm (midnight) "Late" deadline: Friday, September 28, 11:59 pm (Remember that Exam 1 is MONDAY, October 1.) General

More information

! A program is a set of instructions that the. ! It must be translated. ! Variable: portion of memory that stores a value. char

! A program is a set of instructions that the. ! It must be translated. ! Variable: portion of memory that stores a value. char Week 1 Operators, Data Types & I/O Gaddis: Chapters 1, 2, 3 CS 5301 Fall 2016 Jill Seaman Programming A program is a set of instructions that the computer follows to perform a task It must be translated

More information

C++ for Java Programmers

C++ for Java Programmers Basics all Finished! Everything we have covered so far: Lecture 5 Operators Variables Arrays Null Terminated Strings Structs Functions 1 2 45 mins of pure fun Introduction Today: Pointers Pointers Even

More information

Lab 1: Introduction to Java

Lab 1: Introduction to Java Lab 1: Introduction to Java Welcome to the first CS15 lab! In the reading, we went over objects, methods, parameters and how to put all of these things together into Java classes. It's perfectly okay if

More information

Practicum 5 Maps and Closures

Practicum 5 Maps and Closures Practicum 5 Maps and Closures Assignment Details Assigned: February 18 th 2014. Due: February 20 th, 2014 at midnight. Background One of the requirements of PA1 Part 2 using a data structure to hold function

More information