C++ Answers

Questions answered by Experts: 9 913

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

Code a C++ function Min() that takes three double type arguments and that returns the

value of the smallest of the three arguments.


Code a C++ function Circle_Circum() that takes one double argument that represents the

radius of a circle. The function should return the circumference of the circle.


Construct function prototypes that match the following descriptions:

i) ab () takes no arguments and has no return value.

ii) start() takes an int argument and returns a float.

iii) mk() takes two type double arguments and returns a double.

iv) func6() returns an int and takes three arguments. The first and third arguments are of

type double. The second argument is of type int.

v) func4() returns a char and takes one argument that is also of type char.


Write a program that calculates GPA

Arrays in main function

1.  A two dimensional array Grades[Number_of_students][Number_of_subjects] that stores the grades (0 ~ 100) of 6 students for 4 subjects.

2.  A one dimensional array Credit_hours[Number_subjects]

3.  A two dimensional array Grade_points.

 Grade_points [Number_of_students][Number_of_subjects] that will stores the grade points of each subject for 6 students.

4.  A one dimensional array GPA[Number_of_students] that stores the GPA of each student

Write the following Functions

a.  A function Enter_Grades() that takes the two dimensional Grades array.

b.  A function Enter_credit_hours that takes the array Credit_hours.

c.  A function Display_grades

d.  A function Calculate_ Grade_points that takes two arrays Grades and Grade_points.

e.  A function Calculate_GPA that takes three arrays Credit_hours, GPA and

GPA=(GP1*CH1 + GP2*CH2 + GP3*CH3 + GP4*CH4)/(CH1 + CH2 + CH3 + CH4)


generate random integers in the range [ LOW = 1, HIGH = 10000 ] and to store them in a vector < int > of size VEC_SIZE = 250. Then, sort the contents of the vector (in ascending order) and display it on stdout. To sort the contents of a vector, use the sort ( ) function in the STL. In addition to the main ( ) routine, implement the following subroutines in your program: • void genRndNums ( vector < int >& v ) : This routine generates VEC_SIZE integers and puts them in vector v. Initializes the random number generator (RNG) by calling the function srand ( SEED ) with the seed value SEED = 1 and generates random integers by calling the function rand ( ). • void printVec ( const vector < int >& v ) : This routine displays the contents of vector v on stdout, printing exactly NO_ITEMS = 12 numbers on a single line, except perhaps the last line. The sorted numbers need to be properly aligned on the output. For each printed number, allocate ITEM_W = 5 spaces on stdout.


Write a program to create a class “student” that stores name and roll number of a student. Create another class “marks” that stores three subject marks. Print the details of two students along with average mark by using

i)A common friend function to both the classes

ii)Making a member function of

ii)Making a member function of “student” class as friendly to “marks” class.


Create two classes which stores distance in feet, inches and meter, centimeter format respectively. Write a function which compares distance in object of these classes and displays the larger one.


Use the print methods and the appropriate escape sequence.

Comment out your Full Name at the end of your code.

Write a program in C++ to create a class to take student subject marks and name (dynamically as per users input) for two students at the time of creation of objects. Display the details of two students along with the average mark by calling member function.Also deallocate the memory using destructor function. 


Write a program in C++ to create two classes separately each having one integer value as its private data member. Compare both the values and display in main functions whether the values are equal or not. Use pass by address method to execute the code.
LATEST TUTORIALS
APPROVED BY CLIENTS