关闭

Sample 4.21:newstrct.cpp

260人阅读 评论(0) 收藏 举报
分类:
#include<iostream>
struct inflatable
{
    char name[20];
    float volume;
    double price;
};
int main()
{
    using namespace std;
    inflatable * ps = new inflatable;
    cout << "Enter name of inflatable item: ";
    cin.get(ps -> name,20);
    cout << "Enter volume in cubic feet: ";
    cin >> (*ps).volume;
    cout << "Enter price: $";
    cin >> ps -> price;
    cout << "Name: " << (*ps).name; << endl;
    cout << "Volume: " << ps -> volume << " cubic feet\n";
    cout << "Price: $" << ps -> price << endl;
    delete ps;
    return 0;
}

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:36418次
    • 积分:978
    • 等级:
    • 排名:千里之外
    • 原创:56篇
    • 转载:63篇
    • 译文:0篇
    • 评论:1条
    文章存档
    最新评论