728x90

#include
#include
/*
struct point // 1번구간//
{
int x;
int y;
};
void function(struct point call); //2번구간//

int main(void)
{
struct point p = { 10, 20 }; //3번구간//
function(p); //4번구간//

return 0; //6번구간//
}

void function(struct point call) //5번구간//
{
printf("%d %d \n", call.x, call.y);
}
*/
struct product {
char name[20];
int price;
int stock;
};

int main(void)
{
struct product prd1;
struct product prd2 = { "생수2L", 9500, 20 };

strcpy(prd1.name, "지우개");

printf("가격:");
scanf_s("%d", &prd1.price);

printf("재고:");
scanf_s("%d", &prd1.stock);


printf("%s : %d원, 재고량=%d\n",prd1.name, prd1.price, prd1.stock);
printf("%s : %d원, 재고량=%d\n", prd2.name, prd2.price, prd2.stock);

return 0;
}

728x90
Posted by 바르마스
,