Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6COSC 181 – Foundations of Computer ProgrammingClass 10Announcement1st TestWed. Sept 17thComprehensive through the end of this weekClosed Note/Closed BookRead and Interpret Code“trace” codeWrite Code SnippetsSmall programs or parts of programsSyntax matters!Multiple-ChoiceTry ItWrite a program that asks the user for a character. Use if-else control statements to check if the character is an a,e,i,o, or u.If the character is an aPrint out, “You typed in an a”Likewise if it is an e, i, o, or uIf the character was not a vowel print out“You did not enter a vowel.”while Repetition StatementRepetition statementAction repeated while some condition remains truePseudocodeWhile there are more items on my shopping list Purchase next item and cross it off my list •while loop repeats until condition becomes falseExample•int product = 3;while ( product <= 100 ) product = 3 * product;•What will product equal when the loop stops executing?What does this example do?Example•int product = 3;while ( product <= 100 ) product = 3 - product;Try ItUse a single while statement to write the code for our last homework.Read in 20 charactersTell me how many a’s, e’s, i’s, o’s, and u’s there
View Full Document