- Engineering
- Computer Science
- computer science ii func assignment 4 write a c...
Question: computer science ii func assignment 4 write a c...
Question details
Computer Science II – func. assignment #4
Write a C program that has 1 function:
- accepts as parameters two ints (row and column)
- evaluates the row and column and determines if the row and columns numbers would be on a checker board.
- In other words, are the row and column numbers greater than or equal to 0 and less than or equal to 7
- Are the row and column numbers contained on an 8X8 array
- Return true if the row and column numbers are in the array else return false
function headers should be:
bool evaluateRowCol(int row, int col)
in main
- ask for the row and column numbers
- read in the row and column numbers numbers
- call your function bool evaluateRowCol(int row, int col)
- output in main should be
row ?
column ?
is on the checker board
or
is not on the checker board
Use the output (cout) manipulators to format the output correctly [setw(?), fixed, right, left, etc]
Second part
Write a C program named second that will
- ask for and read in a float for a radius
- ask for and read in a float for the height
- each of the following functions will calculate some property of a shape (area, volume, circumference, etc)
- The functions will accept one or two parameters (radius and/or height) and return the proper calculation.
- There is no input/output (cin or cout) in the function – just the calculation
-
write the following functions
- float areaCircle(float radius)
where the area of a circle is calculated by
area = PI * radius * radius
- float circumCircle(float radius)
where the circumference of a circle is calculated by
circumference = PI * radius * 2
- float areaCylinder(float radius, float height)
where the area of a cylinder is calculated by
area = 2 * PI * radius * radius + height * PI * radius * 2
- float volumeCylinder(float radius, float height)
where the volume of a cylinder is calculated by
volume = PI * radius * radius * height
- float volumeCone(float radius, float height)
where the area of a cylinder is calculated by
volume = (1 / 3) * (PI * radius * radius * height)
All input and output (cin and cout) are in maim()
in main()
- get the radius and height
- call each of the functions and print out the answer
- output should look like
radius is ??????
height is ??????
area of the circle is ????????
circumference of the circle is ????????
area of the cylinder is ????????
volume of the cylinder is ????????
volume of the cone is ????????
must be answer both part
and code not suppue to be copy anyone els
Solution by an expert tutor
