描述商品的结构类型

来源:互联网 发布:星知传媒 编辑:程序博客网 时间:2024/06/05 12:08
#include<iostream.h>struct product{unsigned long int id;char name[10];int price;char where[10];int year,month,day;};void main(){float sum=0;product count[10];cout<<"please input the information of production"<<endl;for(int i=0;i<10;i++){cin>>count[i].id>>count[i].name>>count[i].price>>count[i].where>>count[i].year>>count[i].month>>count[i].day;}cout<<"产品的总价值为"<<endl;for(i=0;i<10;i++){sum+=count[i].price;       }cout<<sum<<endl;}

0 0
原创粉丝点击