C++ 产生损坏数据的程序

C++ 产生损坏数据的程序,c++,C++,我不确定我在这里做错了什么,但是当我编译这个程序时,控制台输出将所有数据显示为奇怪的损坏字符和似乎是十六进制数 来源如下: #include "stdafx.h" #include <iostream> using namespace std; int main() { int x[10] = { -5, 4, 3 }; char letters[] = { 'a', 'b', 'c' }; double z[4]; cout <<

我不确定我在这里做错了什么,但是当我编译这个程序时,控制台输出将所有数据显示为奇怪的损坏字符和似乎是十六进制数

来源如下:

#include "stdafx.h"

#include <iostream>

using namespace std;

int main()
{
    int x[10] = { -5, 4, 3 };
    char letters[] = { 'a', 'b', 'c' };
    double z[4];

    cout << x;
    cout << "\n";
    cout << letters;
    cout << "\n";
    cout << z;
    cout << "\n";
    system("pause");
    return 0;
}
#包括“stdafx.h”
#包括
使用名称空间std;
int main()
{
int x[10]={-5,4,3};
字符字母[]={a',b',c'};
双z[4];

cout您正在打印x和z的数组指针,如果您想打印需要循环的值并像这样使用索引运算符[],它将为您提供一个十六进制地址

for (int i = 0; i < some number; i++) { cout << x[i];}

for(int i=0;i