×

### Let's log you in.

or

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

×

or

## CPT 234 Study Guide Exam #2

by: Lukas Notetaker

4

0

6

# CPT 234 Study Guide Exam #2 CPT 234

Lukas Notetaker
TCTC
GPA 3.903

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

×
Unlock Preview

This is a study guide for exam #2
COURSE
C Programming I
PROF.
George Edward Fiori
TYPE
Study Guide
PAGES
6
WORDS
CONCEPTS
C, c++
KARMA
50 ?

## Popular in Computer Programming

This 6 page Study Guide was uploaded by Lukas Notetaker on Saturday September 24, 2016. The Study Guide belongs to CPT 234 at Tri-County Technical College taught by George Edward Fiori in Fall 2016. Since its upload, it has received 4 views. For similar materials see C Programming I in Computer Programming at Tri-County Technical College.

×

## Reviews for CPT 234 Study Guide Exam #2

×

×

### 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: 09/24/16
Variable 1 Relation Operator Variable 2 Result 4 < 5 True 4 4 False 5 > 4 True 4 4 False 4 <= 5 True 4 4 True 5 >= 4 True 4 4 True 4 == 5 False 4 4 True 4 3 False 4 != 5 True 4 4 False 4 3 True Else ­ If Structure if( condition ){ // These lines of codes will be executed if the condition is fulfilled. ___________________________________________________ ___________________________________________________ } // The end of “if” statement else{ // These lines of codes will be executed if the condition is not fulfilled. ___________________________________________________ ___________________________________________________ } // The end of “else” statement Example: if(AGE >= 21){ printf_s(“You are eligible\n”); } else{ printf_s(“You are not eligible\n”); } Input ­> Output 21 You are eligible Input ­> Output 20 You are not eligible Else ­ Else If ­ If Structure if( condition ){ // These lines of codes will be executed if the condition is fulfilled. ___________________________________________________ ___________________________________________________ } // The end of “if” statement Else if( condition ){ // These lines of codes will be executed if the second condition is fulfilled and if  the first condition is not fulfilled. ___________________________________________________ ___________________________________________________ } // The end of “else” statement else{ // These lines of codes will be executed if all the conditions are not fulfilled. ___________________________________________________ ___________________________________________________ } // The end of “else” statement Nested If Structure if(condition){ if(condition){ _______________ _______________ } } Else if(condition){ } Example: if(country == USA){ if(age > 21){ _______________ _______________ } } Logical Operator Logical Operator in C And && Or || Not ! Logical Operator Structure True && False ­> False True ||  False ­> True True && !False ­> True Logical Operator Order: 1. Not 2. And 3. Or Define a bool variable: Bool isNeg = False Switch Statement Switch(age){ Case 1: ___________ break; Case 5: ___________ break; Case 11: ___________ break; Default: ___________ break; } // Programmer: Lukas Herman // Date: 09/19/2016 // Program Name: In Class Program ­ Miles per Gallon // Chapter: Chapter #3 ­ Decision (Branches) // Description: Ask user for a number in range 1 to 10. Then convert the number // to its Roman numeral uquivalent with switch statement. #include <stdio.h> #include <string.h> int main() { int num = 0; printf_s("Enter a number from 1 to 10 inclusive: "); scanf_s("%d", &num); // Blank line printf_s("\n"); // Validate num if it is in range 1 to 10 switch (num) { case 1: printf_s("The number entered, %d, in Roman numerals is %s.", num, "I"); break; case 2: printf_s("The number entered, %d, in Roman numerals is %s.", num, "II"); break; case 3: printf_s("The number entered, %d, in Roman numerals is %s.", num,  "III"); break; case 4: printf_s("The number entered, %d, in Roman numerals is %s.", num,  "IV"); break; case 5: printf_s("The number entered, %d, in Roman numerals is %s.", num, "V"); break; case 6: printf_s("The number entered, %d, in Roman numerals is %s.", num,  "VI"); break; case 7: printf_s("The number entered, %d, in Roman numerals is %s.", num,  "VII"); break; case 8: printf_s("The number entered, %d, in Roman numerals is %s.", num,  "VIII"); break; case 9: printf_s("The number entered, %d, in Roman numerals is %s.", num,  "IX"); break; case 10: printf_s("The number entered, %d, in Roman numerals is %s.", num, "X"); break; default: printf_s("The number entered, %d, is not in the range of 1 to 10.", num); break; } //Blank Line printf_s("\n"); return 0; } // end main()

×

×

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

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

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