内存地址打印还是字符串?

时间:2014-01-10 13:31:45

标签: c++ memory

我正在尝试打印出我的数组的内容,但它也会打印每个元素的内存地址,然后打印该元素。

void generateEndOfDayReport(taxiDetails taxiDataStore[], fareDetails reportArray[])
for (int i = 0; i < 14; i++)
        {   cout << "Here is a list of the taxi drivers in ascending last name order: " <<
            cout << taxiDataStore[i].taxiDriverSurname << endl << "And here is the money they took in over the course of today: £" <<  taxiDataStore[i].fareDetailsForTaxi.overAllFareDetails << endl << endl;
        }![enter image description here][1]

1 个答案:

答案 0 :(得分:1)

通过你的代码看,你有一个错字,它写着:

cout << some-text << cout << variable << endl << some-more-text << variable << endl << endl;

请注意,您正在将cout发送到cout。这真的是你的意图吗?