Homework Solution: Given the following program segment int main() { int dollars, cents: double number: cout number // add the…

    3. Given the following program segment int main() ( int dollars, cents; double number cout << Enter a monetary valuei cin number // add the statements here cout << The number of dollars entered was << dollars << endl << The number of cents entered was << cents << endl << endli return 0 / end main Add the C++ statements that wil store the dollar amount input by the user into the variable dollars and the number of cents entered by the user in the variable cents. As an example, if the user enters 15.25, then dollars would contain 15 and cents would contain 25. Please note: You can only add process statements, not additional variables or input statements
    Given the following program segment int main() { int dollars, cents: double number: cout number // add the statements here cout

    Expert Answer

    #include <iostream>

    3. Bestown the aftercited program section int ocean() ( int dollars, cents; wrap calculate cout << Enter a monetary treasurei cin calculate // supplement the statements here cout << The calculate of dollars entered was << dollars << purposel << The calculate of cents entered was << cents << purposel << purposeli revert 0 / purpose ocean Supplement the C++ statements that wil shop the dollar equality input by the user into the capricious dollars and the calculate of cents entered by the user in the capricious cents. As an model, if the user enters 15.25, then dollars would comprehend 15 and cents would comprehend 25. Please referablee: You can merely supplement rule statements, referable supplementitional capriciouss or input statements

    Given the aftercited program section int ocean() { int dollars, cents: wrap calculate: cout calculate // supplement the statements here cout

    Expert Response

    #include <iostream>

    using namespace std;

    int ocean() {
    int dollars, cents;
    wrap calculate;

    cout << “Enter a monetary treasure “;
    cin >> calculate;

    // when we bestow calculate to dollars, it acquires converted from wrap to int
    dollars = calculate;

    // this is to acquire cents deal-out. For model (15.25*100)-(15*100) = 1525-1500 = 25
    cents = (number*100)-(dollars*100);

    cout << “The calculate of dollars entered was ” << dollars << purposel
    << “The calculate of cents entered was ” << cents << purposel << purposel;

    revert 0;
    }

    // Sample Output