#include <stdio.h> /** *描述:结构体的使用 *时间:2014年9月17日 */ int main() { struct Product { char cName[10]; //产品名称 char cShape[20]; //产品形状 char cColor[10]; //产品颜色 char cArea[20]; //产品产地 int iPrice; //产品价格 }; struct Product phone; //定义结构体变量 printf("请输入产品的名字:\n"); scanf("%s",&phone.cName); printf("输入产品形状:\n"); scanf("%s",&phone.cShape); printf("输入产品颜色\n"); scanf("%s",&phone.cColor); printf("输入产品产地\n"); scanf("%s",&phone.cArea); printf("输入产品价格\n"); scanf("%d",&phone.iPrice); printf("输出信息======================\n"); printf("产品名称:%s\n",phone.cName); printf("产品形状:%s\n",phone.cShape); printf("产品颜色:%s\n",phone.cColor); printf("产品产地:%s\n",phone.cArea); printf("产品价格:%d\n",phone.iPrice); return 0; }