×

### Let's log you in.

or

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

×

or

by: awright

23

0

3

# ECE 118 Notes ECE 118

awright
UM
GPA 3.9

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

×
Unlock Preview

Notes from February
COURSE
Intro to Programming Languages
PROF.
Kubat
TYPE
Class Notes
PAGES
3
WORDS
KARMA
25 ?

## Popular in Computer Science and Engineering

This 3 page Class Notes was uploaded by awright on Sunday February 28, 2016. The Class Notes belongs to ECE 118 at University of Miami taught by Kubat in Fall 2015. Since its upload, it has received 23 views. For similar materials see Intro to Programming Languages in Computer Science and Engineering at University of Miami.

×

## Reviews for ECE 118 Notes

×

×

### 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/28/16
2.24.2016 Notes With Recursion int how_many_digits_R(int const N) { if (N<10) return(1); else return(1+how_many_digits_R(N/10)); } void print_right_aligned(int const length, int const number) { int const n = how_many_digits_R(number); if (n <= length) { print_spaces(length-n); print(number); } else print("not enough space"); } void main() { int const n = 9456; print_right_aligned(7,n); new_line(); } With Loops int how_many_digits(int const number) { int result = 1; int n = number / 10; int const i = 1; while (n > 0) { result = result + i; n = n/10; return(result); } } void print_spaces(int const n) { int i=1; while (i <= n) { print(" "); i = i + 1; } } void print_right_aligned(int const length, int const number) { int const n = how_many_digits(number); if (n <= length) { print_spaces(length-n); print(number); } else print("not enough space"); } void main() { int const n = 9456; print_right_aligned(7,n); new_line(); } Using Recursion To Say Numbers void say(int const n) { if (n==0) print("ZERO"); else if (n==1) print("ONE"); else if (n==2) print("TWO"); else if (n==3) print("THREE"); else if (n==4) print("FOUR"); else if (n==5) print("FIVE"); else if (n==6) print("SIX"); else if (n==7) print("SEVEN"); else if (n==8) print("EIGHT"); else if (n==9) print("NINE"); else if (n==10) print("TEN"); else if (n==11) print("ELEVEN"); else if (n==12) print("TWELVE"); else if (n==13) print("THIRTEEN"); else if (n==14) print("FOURTEEN"); else if (n==15) print("FIFTEEN"); else if (n==16) print("SIXTEEN"); else if (n==17) print("SEVENTEEN"); else if (n==18) print("EIGHTEEN"); else if (n==19) print("NINETEEN"); else if (n==20) print("TWENTY"); else if (n==30) print("THIRTY"); else if (n==40) print("FORTY"); else if (n==50) print("FIFTY"); else if (n==60) print("SIXTY"); else if (n==70) print("SEVENTY"); else if (n==80) print("EIGHTY"); else if (n==90) print("NINETY"); else if (n<=99) { say((n/10)*10); print(" "); say(n%10); } else if (n<=999) { say(n/100); print(" HUNDRED"); if (n%100 !=0) { print(" AND "); say(n%100); } } else if (n <= 999999) { say(n/1000); print(" THOUSAND "); if (n%1000 !=0) say(n%1000); } else print("this number is too big for me"); } void main() { say(11110); }

×

×

### 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

Bentley McCaw University of Florida

#### "I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Amaris Trozzo George Washington University

#### "I made \$350 in just two days after posting 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