CECS 478 Lecture 10: Loops Part 2

46 views2 pages

Document Summary

Count the number of uppercase letters in a string str = helloworld . count = 2. Int count = 0; for (int i = 0; i < str. length(); i++) char ch = str. charat(i); if (character. isuppercase(ch)) count++; The loop will keep going until you find the right character. If there is no character in the entered string, found = false and pos = number of characters (you have reached the end of the string so it stops looking) if (found) To print * * * * : for (i = 0; i < 4; i++) To print: * * * ; for (i = 1; i < = 3; i++) for ( j=0; j < 4; j++) Let j = number of columns and i = number of rows for (i = 1; i <= 4; i++) for ( j = 1; j <= 1; j++)

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents