cuốn sách gpt4 ai đã làm

c++ - 以下 if 语句中的条件是做什么的?

In lại Tác giả: Walker 123 更新时间:2023-11-28 02:38:14 29 4
mua khóa gpt4 Nike

if (read(read(cin, data1), data2))

Vấn đề làC++ Primer 5th Edition 的练习。 read 函数定义如下:

std::istream &read(std::istream &is, Sales_data &item)
{
double price = 0;
is >> item.bookNo >> item.units_sold >> price;
item.revenue = price * item.units_sold;
return is;
}

if 语句中的条件是做什么的?我无法理解这一点。

câu trả lời hay nhất

What does the condition in the if statement do? I can't understand this point.

你不应该要求练习的答案;这降低了学习效果。再次浏览章节和函数,看看您是否能找到重点。

如果你把它写得有点不同,也许它会有所帮助:

   std::istream& a = read(cin, data1);
std::istream& b = read(a , data2);
if (b)
// ...

关于c++ - 以下 if 语句中的条件是做什么的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26818628/

29 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress