compile_error

compile_error - double pctAgainst = 100.0 * numberAgainst /...

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> 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; double pctFor = 100.0 * numberFor / numberSurveyed;
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 pctAgainst = 100.0 * numberAgainst / numberSurveyed; cout.setf(ios::fixed); // see pp. 31-32 in Savitch book cout.precision(1); cout &lt;&lt; endl; cout &lt;&lt; pctFor &lt;&lt; &quot;% support the proposal.&quot; &lt;&lt; endl; cout &lt;&lt; pctAgainst &lt;&lt; &quot;% oppose the proposal.&quot; &lt;&lt; endl; if (numberFor &gt; numberAgainst) cout &lt;&lt; &quot;More people support the proposal than oppose it.&quot; &lt;&lt; endl; else cout &lt;&lt; &quot;More people oppose the proposal than support it.&quot; &lt;&lt; endl; }...
View Full Document

This note was uploaded on 11/10/2011 for the course CS 31 taught by Professor Melkanoff during the Spring '00 term at UCLA.

Ask a homework question - tutors are online