+ All Categories
Home > Documents > CS250 Intro to CS IIzeus.cs.pacificu.edu/ryand/cs250/2017/Lectures/01Review.pdf · 2017-02-06 ·...

CS250 Intro to CS IIzeus.cs.pacificu.edu/ryand/cs250/2017/Lectures/01Review.pdf · 2017-02-06 ·...

Date post: 14-Aug-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
12
CS250 Intro to CS II Doug Ryan [email protected] Strain 201 Office hours: MWF 10-11am Or by appointment Spring 2017 CS250 - Intro to CS II 1
Transcript
Page 1: CS250 Intro to CS IIzeus.cs.pacificu.edu/ryand/cs250/2017/Lectures/01Review.pdf · 2017-02-06 · CS250 Intro to CS II Doug Ryan ryand@pacific.edu Strain 201 Office hours: MWF 10-11am

CS250 Intro to CS IIDoug Ryan

[email protected]

Strain 201

Office hours: MWF 10-11am

Or by appointment

Spring 2017 CS250 - Intro to CS II 1

Page 2: CS250 Intro to CS IIzeus.cs.pacificu.edu/ryand/cs250/2017/Lectures/01Review.pdf · 2017-02-06 · CS250 Intro to CS II Doug Ryan ryand@pacific.edu Strain 201 Office hours: MWF 10-11am

Welcome!

• Web Page http://zeus.cs.pacificu.edu/ryand/cs250/2017

• Syllabus

• Calendar

• Text Book

• Visual Studio 2015

Spring 2017 CS250 - Intro to CS II 2

Page 3: CS250 Intro to CS IIzeus.cs.pacificu.edu/ryand/cs250/2017/Lectures/01Review.pdf · 2017-02-06 · CS250 Intro to CS II Doug Ryan ryand@pacific.edu Strain 201 Office hours: MWF 10-11am

Progression!

• CS 150

– C++ mechanics

– Visual Studio mechanics, Debugger

• CS 250

– C++ mechanics (structs, classes)

– Object oriented programming and design

– Graphics (SDL 2)

• CS 485 (Spring 2019)

– C++ mechanics (C++11, C++14, templates, STL)

– Object oriented design

– Design patternsSpring 2017 CS250 - Intro to CS II 3

Page 4: CS250 Intro to CS IIzeus.cs.pacificu.edu/ryand/cs250/2017/Lectures/01Review.pdf · 2017-02-06 · CS250 Intro to CS II Doug Ryan ryand@pacific.edu Strain 201 Office hours: MWF 10-11am

What I think you know

• Variables & data types

• Relational & logical operators

• Decision statements

• Repetition statements including nesting

• Functions

• Files

• Arrays

• Character processing

• Visual Studio

• Debugger

Spring 2017 CS250 - Intro to CS II 4

Page 5: CS250 Intro to CS IIzeus.cs.pacificu.edu/ryand/cs250/2017/Lectures/01Review.pdf · 2017-02-06 · CS250 Intro to CS II Doug Ryan ryand@pacific.edu Strain 201 Office hours: MWF 10-11am

This class

• More C++ mechanics– Arrays

– Structs

– Classes

– Pointers

• Graphics programming– SDL

• Object Oriented Design

Spring 2017 CS250 - Intro to CS II 5

Page 6: CS250 Intro to CS IIzeus.cs.pacificu.edu/ryand/cs250/2017/Lectures/01Review.pdf · 2017-02-06 · CS250 Intro to CS II Doug Ryan ryand@pacific.edu Strain 201 Office hours: MWF 10-11am

Review

Review Reading: pp. 265-284 (files) pp. 375-425 (arrays)

Topics to Review

Files (Reading & Writing)

Arrays (1D & 2D)

Character Processing

Spring 2017 CS250 - Intro to CS II 6

Page 7: CS250 Intro to CS IIzeus.cs.pacificu.edu/ryand/cs250/2017/Lectures/01Review.pdf · 2017-02-06 · CS250 Intro to CS II Doug Ryan ryand@pacific.edu Strain 201 Office hours: MWF 10-11am

Files

What is a stream?

How do we create a stream for reading from a file?

Spring 2017 CS250 - Intro to CS II 7

Page 8: CS250 Intro to CS IIzeus.cs.pacificu.edu/ryand/cs250/2017/Lectures/01Review.pdf · 2017-02-06 · CS250 Intro to CS II Doug Ryan ryand@pacific.edu Strain 201 Office hours: MWF 10-11am

One-dimensional arrays

Consider int aIntArry[] = {1, 2, 3, 4, 5};

double aDoubleArry[10];

1. What are the index values for each array?

2. How many elements does each array have?

3. Arrays consist of homogeneous data. What does this mean?

Spring 2017 CS250 - Intro to CS II 8

Page 9: CS250 Intro to CS IIzeus.cs.pacificu.edu/ryand/cs250/2017/Lectures/01Review.pdf · 2017-02-06 · CS250 Intro to CS II Doug Ryan ryand@pacific.edu Strain 201 Office hours: MWF 10-11am

Problem #1DNA Length

A DNA string represents the order of nucleobasesalong one strand of a double-stranded DNA molecule

The other strand is the reverse complement of the string

DNA strings are constructed from the alphabet {A, C, G, T} representing the bases adenine, cytosine, guanine, and thymine

Spring 2017 CS250 - Intro to CS II 9

Page 10: CS250 Intro to CS IIzeus.cs.pacificu.edu/ryand/cs250/2017/Lectures/01Review.pdf · 2017-02-06 · CS250 Intro to CS II Doug Ryan ryand@pacific.edu Strain 201 Office hours: MWF 10-11am

Problem #1DNA Length

• The DNA string AAGATGCCGT has length 10 nucleobases (or just bases)

• Write a function getDNALength that accepts a character array (that ends with null) and returns the length of a DNA string

Spring 2017 CS250 - Intro to CS II 10

Page 11: CS250 Intro to CS IIzeus.cs.pacificu.edu/ryand/cs250/2017/Lectures/01Review.pdf · 2017-02-06 · CS250 Intro to CS II Doug Ryan ryand@pacific.edu Strain 201 Office hours: MWF 10-11am

Problem #2Reverse Complement

In DNA strings, the symbols A and T are complements of each other as are C and G

The reverse complement of a DNA string 𝑠 is formed by reversing the contents of 𝑠 and then taking the complement of each symbol

The DNA string AAAACCCGGT has the reverse complement ACCGGGTTTT

Spring 2017 CS250 - Intro to CS II 11

Page 12: CS250 Intro to CS IIzeus.cs.pacificu.edu/ryand/cs250/2017/Lectures/01Review.pdf · 2017-02-06 · CS250 Intro to CS II Doug Ryan ryand@pacific.edu Strain 201 Office hours: MWF 10-11am

Problem #2Reverse Complement

The data file dnastrings.txt contains an unknown number of DNA strings where each string has length at most 1000 bases

Write a program to output

each DNA string

the reverse complement of each DNA string

Let’s write

well-defined function prototypes

each function definition

main function for solving the stated problem

Spring 2017 CS250 - Intro to CS II 12


Recommended