troubleshooting Question

# lab4.cpp Code Syntax and Algorithm Check

asked on
C++
18 Comments13 Solutions319 ViewsLast Modified:
Is this correct?  Please advise.  Del
*******************************Actual Code*********************************
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
#include <cmath>

int biggest(const int, const int, const int);
int gcd(const int, const int);
void addBlanks(){};
double round(const double);

int main() {

rand();
srand(time(0));
time(0);

int x, y, z, randOut, srandOut;
cout << "Enter three integers. " << endl;
cin >> x >> y >> z;

cout << "The biggest of " << x << "," << y << ", and " << z << "is " << biggest(x,y,z) << endl;
cout << "The greatest comon divisor of " << x << " and " << y << " is " << gcd(x,y) << endl;
cout << randOut << " is a random number. " << endl;
cout << srandOut << " is a seeded random number. " << endl;
cout << "The rounded number is " << round(floatNum) << endl;

return 0;

}

int biggest(const int x, const int y, const int z) {

int size;
if((x < size) && (y < size) && (z < size))
return size;

}

int gcd(const int x, const int y) {

int remainder = x % y;
if(remainder != 0)
return gcd(remainder, x);
return x;

}

void addBlanks() {

//generate random #, print digits seperated by 5 spaces

double firstDigit = digit;
for(int digit = 4; digit >= 0; digit--)
cout << firstDigit << " ";

return;

}

double round(const double floatNum) {

//round parameter to the nearest int
floor(floatNum);
pow(floatNum,);

}

**************************************************************************************

output:

lab4.cpp: In function `double round(double)':
lab4.cpp:67: parse error before `)'

I am not sure on addBlanks() and double round()...please advise.

Description of the problem below:
*************************************************************************************
PART I.
Write function definitions for the following prototypes:

int biggest(const int, const int, const int );
// Returns the largest of three integers.

int GCD( const int, const int );
// returns the greatest common divisor (GCD) of two integers, where GCD is the largest integer that divides both of them evenly.

void addBlanks ( );
/* produce a random integer between 1 and 32767 and print it as a series of digits, where each digit is separated by a space; e.g. 4562 should be printed as: 4 5 6 2 (text 3.25(c) pg 244)*/

PART II.
Write the prototype, definition and call for a function that will take a local double from main and round it to its closest integer value; e.g. 3.45 will become 3.00, and any number >= 3.5 will become 4.00. See pg. 242 Exercise 3.13 for help. The function should modify the value of the double in main.

ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 13 Answers and 18 Comments.
###### Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 13 Answers and 18 Comments.

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.