ProgrammingPearlsChapter3Problem3 

The output is like this:

xxxxxxxxx
xxxxxxxxx
      xx
     xx
    xx
   xx
  xx
 xx
xxxxxxxxx
xxxxxxxxx


xxxxxxxxx
xxxxxxxxx
xxxxxxxxx
   xxx
   xxx
   xxx
   xxx
   xxx
   xxx
xxxxxxxxx
xxxxxxxxx
xxxxxxxxx

Lesson Learned:
1. When you define a local variable inside the loop {...}, it means that this variable will be initialized every time the loop executes.
2. isdigit() and isalpha() can be used to check if the item falls in the range we expected.
3. When you wrote the loop using while, remember to advance the variable so that the loop can end:
while(*p!='\0')
{
    p++; //Remember to add this statement
}

相关文章:

  • 2021-09-08
  • 2021-11-05
  • 2022-12-23
  • 2021-12-15
  • 2022-12-23
  • 2021-07-28
  • 2021-11-28
  • 2021-05-26
猜你喜欢
  • 2021-11-29
  • 2021-09-28
  • 2021-11-24
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
  • 2021-12-13
相关资源
相似解决方案