original

original - double pctFor = 100.0 numberFor numberSurveyed...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// Code for Project 1 // Report poll results #include <iostream> using namespace std; // see p. 36-37 in Savitch book int main() { int numberSurveyed; int numberFor; int numberAgainst; cout << "The Governor proposes to put a tax extension measure on the June ballot." << endl; cout << "How many registered voters were surveyed about this issue? "; cin >> numberSurveyed; cout << "How many support the Governor's proposal? "; cin >> numberFor; cout << "How many oppose the Governor's proposal? "; cin >> numberAgainst;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: double pctFor = 100.0 * numberFor / numberSurveyed; double pctAgainst = 100.0 * numberAgainst / numberSurveyed; cout.setf(ios::fixed); // see pp. 31-32 in Savitch book cout.precision(1); cout << endl; cout << pctFor << "% support the proposal." << endl; cout << pctAgainst << "% oppose the proposal." << endl; if (numberFor > numberAgainst) cout << "More people support the proposal than oppose it." << endl; else cout << "More people oppose the proposal than support it." << endl; }...
View Full Document

Ask a homework question - tutors are online