📄 struct_ret.cpp
字号:
//struct_ret.cpp
#include <iostream.h>
#include <conio.h>
struct rec
{ float price;
int quantity;
float total;
};
rec get_struct();
void main()
{ rec items;
items=get_struct();
cout << "price=" << items.price << endl;
cout << "quantity=" <<items.quantity << endl;
cout << "Total=" << items.total << endl;
getch();
}
//get_struct()
rec get_struct()
{ rec r;
cout << "输入单价与数量:";
cin>>r.price>>r.quantity;
r.total=r.price*r.quantity;
return r;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -