×

### Let's log you in.

or

Don't have a StudySoup account? Create one here!

×

or

by: Angela Rucci

37

0

4

# Week 3 Noted for Data Objects 3700 CSIS 3700, Data Structures and Object

Angela Rucci
YSU
GPA 3.87

Get a free preview of these Notes, just enter your email below.

×
Unlock Preview

Week 3 notes and class examples
COURSE
Data Structures and Objects
PROF.
Dr. Shaffer
TYPE
Class Notes
PAGES
4
WORDS
CONCEPTS
data structures, c++
KARMA
25 ?

## Popular in Computer Science and Engineering

This 4 page Class Notes was uploaded by Angela Rucci on Thursday February 4, 2016. The Class Notes belongs to CSIS 3700, Data Structures and Object at Youngstown State University taught by Dr. Shaffer in Spring 2016. Since its upload, it has received 37 views. For similar materials see Data Structures and Objects in Computer Science and Engineering at Youngstown State University.

×

## Reviews for Week 3 Noted for Data Objects 3700

×

×

### What is Karma?

#### You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 02/04/16
#include "counter.h" #include <iostream> #include <cmath> using namespace std; using namespace csis3700; // motivations for references // 1. function's job is to modify variable (or object) passed to it void swap(int& a, int& b) { int temp = a; // temp = 10 a = b; // a = 99 b = temp; // b = 10 } // 2. "returning" multiple values void circle_info(double r, double& circumference, double& area) { circumference = 2*M_PI*r; area = M_PI*r*r; } // 3. performance: avoid copying void print_count(const counter& c) { cout << c << endl; } int main() { int x = 10; int y = 99; swap(x,y); // expect 99, 10 cout << x << ", " << y << endl; double c,a; circle_info(10, c, a); cout << "c: " << c << " a: " << a << endl; counter c1; c1.increment(2); print_count(c1); } #include "counter.h" #include <iostream> #include <cstdlib> using namespace std; using namespace csis3700; void go_up_by_five(counter& c) { for(int i=0; i < 5; i++) c.increment(); } int main() { counter c1; // calls constructor counter c2(100); // ditto c1.increment(); cout << "c1: " << c1.get_count() << endl; cout << "c2: " << c2.get_count() << endl; c2.increment(); c2.increment(); c2.increment(); c2.increment(-9); cout << "c1: " << c1.get_count() << endl; cout << "c2: " << c2.get_count() << endl; counter c3 = c1 + c2; cout << "c1 + c2: " << c3 << endl; go_up_by_five(c1); cout << c1 << endl; return EXIT_SUCCESS; } #include "student.h" #include <iostream> #include <cstdlib> using namespace std; using namespace csis3700; int main(int argc, char *argv[]) { student s1; student s2; s1.id = 5; s1.name = "Bob"; s2.id = 10; s2.name = "Fred"; student our_class[2]; our_class[0] = s1; our_class[1] = s2; cout << our_class[0].id << ": " << our_class[0].name << endl; cout << our_class[1].id << ": " << our_class[1].name << endl; return EXIT_SUCCESS; }

×

×

### BOOM! Enjoy Your Free Notes!

×

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

## Why people love StudySoup

Steve Martinelli UC Los Angeles

#### "There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Kyle Maynard Purdue

#### "When you're taking detailed notes and trying to help everyone else out in the class, it really helps you learn and understand the material...plus I made \$280 on my first study guide!"

Jim McGreen Ohio University

#### "Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

Parker Thompson 500 Startups

#### "It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

Become an Elite Notetaker and start selling your notes online!
×

### Refund Policy

#### STUDYSOUP CANCELLATION POLICY

All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email support@studysoup.com

#### STUDYSOUP REFUND POLICY

StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here: support@studysoup.com

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to support@studysoup.com