C++语言开发示例:16. 结构体赋值
assign_st.cpp
#include <iostream>
struct inflatable
{
char name[20];
float volume;
double price;
};
int main()
{
using namespace std;
inflatable bouquet = {
"sunflowers",
0.20,
12.49};
inflatable choice;
cout << "bouquet: " << bouquet.name << " for $";
cout << bouquet.price << endl;
choice = bouquet;
cout << "choice: " << choice.name << " for $";
cout << choice.price << endl;
} 最后更新于1年前
本文由人工编写,AI优化,转载请注明原文地址: C++语言开发示例:16. 结构体赋值
推荐阅读
评论 (0)
发表评论
昵称:加载中...
暂无评论,快来发表第一条评论吧!