Thursday, 12 January 2012

Write a C++ program that will calculate the total rate of receiving dollars for each bushel. You have to take total number of dollars you have received and total number of bushels for which you get dollars as inputs from user, and...

Write a C++ program that will calculate the total rate of receiving dollars for each bushel. You have to take total number of dollars you have received and total number of bushels for which you get dollars as inputs from user, and then display the result up to two decimal places




#include <iostream.h>
#include<conio.h>
using namespace std;

int main()
{
        clrscr();
    float bushels, dollars, rate;
    cout << "Enter the Number of Dollars" << endl;
    cin >> dollars;
    cout << "Enter the Number of Bushels" << endl;
    cin >> bushels;
    rate=dollars/bushels;
    cout. precision (4);
    cout << "You have received $ " << rate << " for each bushel.";
    getche();
    return 0;
}

No comments:

Post a Comment