Quiz 04 “Minimum and Squares”

What to do:

You implement these function in your own program in a file quiz4.cpp.

You should make a main routine that asks the user for three numbers and then calls your functions to which should *RETURN* the value and you print in the main program.

Publish your code on your own blog today (during class time is best) and use the tag #Quiz04 so it shows up nicely in our tag cloud.


#include <iostream>
#include <cmath>
using namespace std;
int sumSquares(int x, int y, int z) {
return pow (x,2)+pow(y,2)+pow(z,2);
int minimumThree(int x, int y, int z){
int num;
if (x<=y && y<=z) {
if (y<=x && x<=z) {
if (z<=y && y<=x) {
return num;
int main()
int x,y,z;
std::cout << “give me the x variable” << ‘\n’;
std::cin >> x;
std::cout << “give me the y variable” << ‘\n’;
std::cin >> y;
std::cout << “give me the z variable” << ‘\n’;
std::cin >> z;
std::cout << “the sum of squares are: ” <<sumSquares(x,y,z)<< ‘\n’;
std::cout << “the minimun of the three numbers is: ” <<minimumThree(x,y,z)<< ‘\n’;
return 0;



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s