当前位置:   article > 正文

TJU1001---天大OJ题

天大oj

This is the first problem for test.

Since all we know the ASCII code, your job is simple: Input numbers and output corresponding messages.

 

Input

The input will contain a list of positive integers separated by whitespaces(spaces, newlines, TABs).
Please process to the end of file (EOF).
The integers will be no less than 32.

 

Output

Output the corresponding message.
Note there is NOT a newline character in the end of output.

 

Sample Input

72 101 108 108 111 44
32 119 111 114 108 100 33

Sample Output

Hello, world!
  1. //空格是32 数字的ascll码在48到57之间
  2. void TJU1001() {
  3. char buffer[100];
  4. int i = 0; //指针
  5. int a;
  6. cin.getline(buffer, 100); //接收一行数据
  7. while (buffer[i] != '\0') {
  8. a = 0;
  9. while (buffer[i] != 32 && buffer[i] != 0) {
  10. a *= 10;
  11. a += (int)buffer[i++] - 48;
  12. }
  13. cout << (char)a;
  14. while (buffer[i] == 32)
  15. i++;
  16. if (buffer[i] == 0) {
  17. //到了末尾就要从零开始
  18. cin.getline(buffer, 100);
  19. i = 0;
  20. }
  21. }
  22. }

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/不正经/article/detail/400345?site
推荐阅读
相关标签
  

闽ICP备14008679号