下列程序的输出结果是
#include
using namespace std;
int main()
{
char a[] = "Hello, World";
char *ptr = a;
while (*ptr)
{
if (*ptr >= 'a' && *ptr <= 'z')
cout << char(*ptr + 'A' -'a');
else cout << *ptr;
ptr++;
}
return 0;
}
A、 HELLO, WORLD
B、Hello, World
C、hELLO, wORLD
D、hello, world
#include
using namespace std;
int main()
{
char a[] = "Hello, World";
char *ptr = a;
while (*ptr)
{
if (*ptr >= 'a' && *ptr <= 'z')
cout << char(*ptr + 'A' -'a');
else cout << *ptr;
ptr++;
}
return 0;
}
A、 HELLO, WORLD
B、Hello, World
C、hELLO, wORLD
D、hello, world