c语言计算价格

小编:优质农业网   人气:0℃   发布时间:2025-02-18 09:09:06
字号:

int?main()

c语言计算价格

{

int?price[100];

intn,?m,?total?=?0,?i;

scanf("%d?%d",?&n,?&m);

i?=?0;

while?(i?<?n)?{

int?no,?p;

scanf("%d?%d",?&no,?&p);

price[no-1]?=?p;

i++;

}

i?=?0;

while?(i?<?m)?{

int?no,?cnt;

scanf("%d?%d",?&no,?&cnt);

total?+=?cnt?*?price[no-1];

i++;

}

printf("%dn",?total);

return?0;

}

版权声明:本站文章来源互联网,如有侵犯您的权益,请及时联系我们处理;

原文链接:https://baike.tt44.com/news/1_469425.html