我有三组数据如 华为 100华为 200三星 200我想以华为为条件,把100和200加起来,我该怎么设计代码?
1.先定义struct Phone{char brand[20];int price;};2. 然后定义 Phone phone[N]; N为你想要多少组;3.输入数据;4.遍历数组phone,把条件满足(strcmp(phone[i].brand,"华为") == 0)的把phone[i].price 累加;