Computers and Technology
Computers and Technology, 24.06.2019 18:50, nika0001

Write a program that reads in a series of lines of input character by character (using the library function the first line of the input contains an integer which specifies the number of remaining lines of input, each of which contains a floating point number. the integer value on the first line can be read with (the library function) but all of the following lines can only be read with each line, after the first, contains a single floating point value, with up to four digits before the decimal point, and up to four digits following the decimal point, but there is not necessarily a decimal point in each number; i. e., it may appear to be an integer, but the digits should be read by your program, and the number should be converted to a corresponding floating point number. for instance, suppose the following input: 5 3.1255 20.25 0.875 1921.50 31 the required output is: − each of the input floating point values, printed on a separate line with four digits of precision, using printf(); − on the last line of the output, the string “total: ” followed by the sum of the input values, printed with printf() to 4 digits of precision. for example, the total of the sample input given above is 1976.7505, so the required output for this input would be: 3.1255 20.2500 0.8750 1921.5000 31.0000 total: 1976.7505 do not concern yourself with small differences in the total due to rounding, as the grader will not deduct points for this. constraints: − you are not allowed to use arrays on this portion of the lab assignment. − there is no maximum number of lines allowable. it all depends upon the first value of input. since you aren’t saving anything, it doesn’t matter. − you can assume that input will not contain more than 4 digits before or after the decimal point. you do not need to error check for this condition. -you must use getchar() to read in the floating point values one character at a time (i. e. do not use -you must declare and use your floating point values as a double to minimize rounding errors. -only use printf() to output the floating point numbers and the total (do not use − be sure your directions to the user are clear so they are sure to enter the input data correctly.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 02:30, woodpeckerdeejpe8wvh
How to launch an app: steps to be successful? launching an app is a great idea, but it’s not that easy as we supposed to think. the majority of mobile applications don’t generate revenue because companies aren’t ready to be competitive. referring to our experience in successfully building and launching apps we hope to you omit these difficulties. we are going to talk about ideas, marketing, testing your product, its development, distribution and support. you will learn 8 product launch stages to succeed.
Answers: 1
image
Computers and Technology, 23.06.2019 13:30, juliajordan427
Best laptops for college [$100-$500 range]?
Answers: 2
image
Computers and Technology, 24.06.2019 14:30, heathersloan274
Which computer network component connects two different networks together and allows them to communicate? a is a node (or a device) that connects two different networks together and allows them to communicate.
Answers: 1
image
Computers and Technology, 24.06.2019 17:40, palmekar000
When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. this can be done by normalizing to values between 0 and 1, or throwing away outliers. for this program, adjust the values by subtracting the smallest value from all the values. the input begins with an integer indicating the number of integers that follow. ex: if the input is 5 30 50 10 70 65, the output is: 20 40 0 60 55
Answers: 1
Do you know the correct answer?
Write a program that reads in a series of lines of input character by character (using the library f...

Questions in other subjects:

Konu
English, 22.08.2021 21:30
Konu
Geography, 22.08.2021 21:30
Konu
Biology, 22.08.2021 21:30
Konu
Mathematics, 22.08.2021 21:30
Konu
Mathematics, 22.08.2021 21:30