Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. input (what you will type in the console) = 'Get out'
  2. lastChar = '\0'
  3.  
  4. In a while loop:
  5. 1 First time, c = 'G'. Is c a space? nope, is lastChar a space? nope, ok then just print 'G'
  6. 2 Second time, c = 'e'. Is c a space? nope, is lastChar a space? nope, ok then just print 'e'
  7. 3 Third time, c = 't'. Is c a space? nope, is lastChar a space? nope, ok then just print 't'
  8. 4 Fourth time, c = ' '. Is c a space? Yes! is lastChar a space? nope, ok let me make lastChar = ' ' and print ' '
  9. 5 Fifth time, c = ' '. Is c a space? Yes! ok is lastChar a space? Yes! ok then let's not print anything
  10. 6 Sixth time, c = ' '. Is c a space? Yes! ok is lastChar a space? Yes! ok then let's not print anything
  11. 7 Seventh time, c = 'o'. Is c a space? nope, ok is lastChar a space? Yes! ok make lastChar = '\0' and print 'o'
  12. 8 Eight time, c = 'u'. Is c a space? nope, ok is lastChar a space? nope, ok then just print 'u'
  13. 9 Ninth time, c = 't'. Is c a space? nope, ok is lastChar a space? nope, ok then just print 't'
  14. 10 Tenth time, c = EOF. Welp while loop ends here....
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement