### Create a StudySoup account

#### Be part of our community, it's free to join!

Already have a StudySoup account? Login here

# ECE 118 Notes ECE 118

UM

GPA 3.9

### View Full Document

## 23

## 0

## Popular in Intro to Programming Languages

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

#### Karma is the currency of StudySoup.

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

We've added these Notes to your profile, click here to view them now.

### You're already Subscribed!

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

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

#### "I made $350 in just two days after posting my first study guide."

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

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

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

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.