이 프로그램은 문자를 ASCII 코드 으로 변환합니다. 프로그램은 완벽하게 작동하지만 행 cout << (int) *p1++ << ' ';
의 작동 방식을 이해하지 못합니다. 이 내부 루프 while
Еspecially *p1++
: 여기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"));
}
해당 언어의 책자를 가져옵니다. –