|

登陆享受更多浏览权限哟~
您需要 登录 才可以下载或查看,没有帐号?入驻经典 
x
<p>题目: 商品价格统计</p><p>一 语言与环境</p><p> A.实现语言<br/>C<br/> B.环境要求<br/>1 .Turbo C 2.0或者以上版本开发环境<br/>二 要求</p><p> 请用C语言编写一个程序,完成如下功能;定义一个结构数组,输入4种商品的名称,单价,数量,要求计算并逐个输出每种商品的总价,最后输出单价最高的商品价格。<br/>三 实现步骤</p><p> 1. 定义一个结构体,其中包括商品名称,单价,数量和总价四个成员。<br/> 2. 在程序中,使用循环结构控制连续输入(第一个循环)。<br/>2.1 在循环结构中,显示提示信息,要求用户输入商品的名称,单价和数量。<br/>2.2 读取输入的数据<br/>2.3 计算商品总价<br/> 3 .在程序中,使用循环结构控制连续输出(第二个循环)。<br/>3.1 循环输出每种商品的总价<br/>3.2 判断并输出单价最高的商品价格<br/> 4 .运行结果如下图:<br/> <br/> Please enter the name,price and amount of the NO.1 commodity: aaa 1 1 <br/>Please enter the name,price and amount of the NO.2 commodity: bbb 2 2<br/> Please enter the name,price and amount of the NO.3 commodity: ccc 3 3<br/> Please enter the name,price and amount of the NO.4 commodity: ddd 4 4<br/> <br/> The total prices of aaa is :1<br/>The total prices of bbb is :4<br/>The total prices of ccc is :9<br/>The total prices of ddd is :16<br/>The highest price is :4</p><p>D:\turboc><br/> </p><p>四 注意事项 </p><p> A .请注意在程序中进行异常处理;</p><p> B .请注意代码的书写,命名符合规范;</p><p><br/>第9套<br/> <br/><br/></p> |
|