输入
输入将包含一个由空格(空格、换行符、TAB)分隔的正整数列表。请处理到文件末尾 (EOF)。整数将不小于 32。
输出
输出相应的消息。请注意,输出末尾没有换行符。
样例输入
72 101 108 108 111 44
32 119 111 114 108 100 33
样例输出
Hello, world!
#include <iostream>
using namespace std;
int main(void)
{
int n;
while (cin >> n) //EOF = -1
{
if (n < 0) break;
cout << char(n);
}
return 0;
}
直接利用EOF
#include<iostream>
using namespace std;
int main()
{
int n;
while (scanf("%d", &n) != EOF)
{
printf("%c", n);
}
return 0;
}