該程序將字符轉換爲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