Purchase Solution

How to add floating point numbers in C++ and print

Not what you're looking for?

Ask Custom Question

Write a program that asks the user to enter two positive floating point numbers and after checking their validity it prints them in fixed point notation with the width of ten and with two digits to the right of the decimal point. It uses the conditional operator to determine which number is smaller and which number is larger. It adds the larger number to variable total1 and the smaller number to the variable total2. The program should repeat ten times this process of reading the two number comparing them and assigning them to either total1 or total2. Use For loop to implement the repetition. Write the values of total1 and total2 after the loop in an output file.

Purchase this Solution

Solution Summary

The solution shows how to add floating point numbers and print them in fixed point notation using a loop.

Purchase this Solution


Free BrainMass Quizzes
Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Javscript Basics

Quiz on basics of javascript programming language.