Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

When you run this program, it prints 4 3 4 as the value of cents: double price = 4 . 3 5 ; int cents

When you run this program, it prints 434 as the value of cents: double price =4.35; int cents =100* price; // Should be 100*4.35=435 cout << cents << endl; // Prints 434! What is the probable reason? Question 20 options: A roundoff error occurs with (binary) floating point variable values. When double values are assigned to ints, any fractional part is dropped. Both of options are correct. Neither option is correct.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

6th International Edition

061921323X, 978-0619213237

More Books

Students also viewed these Databases questions

Question

Find Vo in the network shown using source transformation 1KCA

Answered: 1 week ago