gpt4 book ai didi

c++ - 内存地址打印以及字符串?

转载 作者:行者123 更新时间:2023-11-28 07:10:35 24 4
gpt4 key购买 nike

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

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]

最佳答案

从你的代码来看,你有一个错字,上面写着:

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

请注意,您正在将 cout 流式传输到 cout。这真的是您想要的吗?

关于c++ - 内存地址打印以及字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21045653/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com