# unit07 - qAvg = pEarned/qTaken q cout<<"Your...

This preview shows pages 1–4. Sign up to view the full content.

Sheet1 Page 1 First // 1 2 5 Second 6 2.3 5 Third 6 2 5 a. 303 b. 10011101000 c. 34630 #include <iostream> #include <cmath> using namespace std double area(double* x) { double a = pow(*x,2)*3.1415 return a } int main() { double r = 3 cout<<"The area of the circle of radius 3 is is: "<<area(xptr)<<endl }

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Sheet1 Page 2 #include <iostream> #include <cmath> using namespace std void quizgrades(int qpoints) { static int ptotal = 0 static int qtaken = 0 ptotal += qtaken*qpoints cout<<"Your total number of quiz points is: "<< ptotal<<endl return } int main() { int x = 1, y = 0 do{ cout<<"Please enter the number of points earned on the last quiz."<<endl cin>>y quizgrades(y) return 1 } #include <iostream> #include <cmath> using namespace std int quizavg(int x) { int qAvg = 0 static int pEarned static int qTaken qTaken +=1 pEarned += x
Sheet1 Page 3

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: qAvg = pEarned/qTaken q cout<<"Your quiz average is: "<<qAvg<<endl return 1 } int main(void) { int x = 0 do{ cout<<"Please enter the grade of the quiz"<<endl cout<<"Enter a -1 to exit"<<endl cin>>x quizavg(x) }while(x<=100 && x>=0) return 0 } #include <iostream> #include <cmath> using namespace std void swap(int* a, int* b) { int placeH = *a *a = *b *b = placeH cout<<"After the swap function, your value for a is "<< *a <<" and your value for b is "<< *b <<endl } int main(void) { int a = 0, b = 0 int* aPtr = &a int* bPtr = &b cout<<"Please enter a value for 'a'"<<endl cin>>a cout<<"Now please enter a value for 'b'"<<endl Sheet1 Page 4 cin>>b cout<<"Your value for 'a' was "<<a<<" and your value for 'b' was "<<b<<endl swap(aPtr,bPtr) return 0 }...
View Full Document

## This note was uploaded on 04/13/2010 for the course ME me205 taught by Professor Pryor during the Spring '09 term at University of Texas-Tyler.

### Page1 / 4

unit07 - qAvg = pEarned/qTaken q cout<<"Your...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online