123456789101112131415161718192021222324252627 |
- // assgn_st.cpp -- assigning structures
- #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; // assign one structure to another
- cout << "choice: " << choice.name << " for $";
- cout << choice.price << endl;
- // cin.get();
- return 0;
- }
|