该程序将字符转换为ASCII码 程序完美运行,但我不明白cout << (int) *p1++ << ' ';
行如何工作。 Еspecially*p1++
在该内while
循环:打印存储在C字符串中的字符的ASCII码 - 需要说明
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
void main()
{
char s[80];
char *p1;
do
{
p1 = s;
cout << "Enter the string";
gets(p1);
while (*p1)
cout << (int) *p1++ << ' ';
cout << '\n';
}
while (strcmp (s, "End"));
}
获取有关该语言的书籍。 – 2013-03-26 09:39:12