jbo214hw3p4 -...

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

View Full Document Right Arrow Icon
/* Joshua Okrent LIN: 819710517 October 4, 2010 HW 1 Khadija Benjlali Section 12 */ using namespace std; #include<iostream> #include<fstream> #include<cmath> #include<iomanip> void locate(double&, int&); int main() { int n; int less=0; double more=0,quotient; cout<<"Enter a value for N between 1 and 10"<<endl; cin>>n; if(n>=10|| n<=1) {cout<<"\nInvalide value. End program."<<endl<<endl<<endl;} else{ locate(more, less);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cout&lt;&lt;&quot;More: &quot;&lt;&lt;more&lt;&lt;endl; cout&lt;&lt;&quot;Less: &quot;&lt;&lt;less&lt;&lt;endl; quotient=(more/n*100); cout&lt;&lt;&quot;Quotient (percentage): &quot;&lt;&lt;quotient&lt;&lt;&quot;%&quot;&lt;&lt;endl&lt;&lt;endl;} system(&quot;pause&quot;); return 0; } void locate(double&amp; more, int&amp; less) { ifstream datain(&quot;testdata.txt&quot;); int counter=0; double x; while(counter&lt;10) { datain&gt;&gt;x; if(x&gt;0.7) {more++;} else if (x&lt;0.6) {less++;} counter++; } }...
View Full Document

Ask a homework question - tutors are online