> 英语 >
英语翻译
write a program to allow a user to do conversions between two different units of measurement.So the user might type in an amount,and the naems of two units of measurement,for example:5,ounce,gram
In this case the program should then print out the number of grams equal to 5 ounces,thus:5 ounces is 140 grams (1 ounce is 28 grams)
The unit names and conversion factors will be supplied as a file convert.txt,and this should be read in by the program at start-up.The file consists of a series of lines,each consisting of two unit names(both strings) and a conversion factor (a number with a decimal point) seqarated by commas,for example:ounce,gram,28.0
This means that one ounce equals 28.0 grams.A sample file is available on the portal,but your program should be able to cope with any file laid out in this way.There is code in section A of the " LinkedList" project to read from such as file; you need" using System.IO;" at the start of the program.
人气:424 ℃ 时间:2020-05-24 02:48:14
解答
写一个让用户可以对两个度量单位进行转换的程序.用户可以输入数量,两种度量单位的名称,比如盎司,克,用户就可以据以算出5盎司是多少克,1盎司是28克那么5盎司是140克.单位名称及计算方式会在一个TXT格式的转换文件中提供,程序开始时要进行读入.文件中,每一行包括两个单位名称和一个十进位的计算方式,分别用逗号隔开,例如:盎司,克,28.0,即表示,每盎司等于28.0克.门户网站已有一个样本文件,但你设计的程序应兼容所有符合这种方式的文件.在链接单(linkedlist)的section A部分有这样的文件,请在程序开始时设定系统using system .IO.
推荐
猜你喜欢
© 2024 79432.Com All Rights Reserved.
电脑版|手机版