pls help with assignment

Ackermann Function
The Ackermann function is the simplest example of a well­defined total function which
is computable but not primitive recursive. The Ackermann function is one of the fastest
growing functions, much faster than polynomials or exponentials. Its definition is:
a. If x = 0 then A(x, y) = y + 1
b. If y = 0 then A(x, y) = A(x­1, 1)
c. Otherwise, A(x, y) = A(x­1, A(x, y­1))
You have to write a C++ program to read two integers x and y, and print the value of A(x, y).
Warning:
Do not try values larger than x=5 and y=5.

Q.2Question
Define a class student with the following specification
Private members of class student.

admno integer
sname 20 character
eng. math, science float
total float
ctotal() a function to calculate eng + math + science with float return type.

Public member function of class student

getData() Function to accept values for admno, sname, eng, science
and invoke ctotal() to calculate total.

showData() Function to display all the data members on the screen
Wtite a C++ program to demostrate takeing the values and display them.


Q3

Define a C++ class batsman with the following specifications:
Private members:
bcode 4 digits code number

bname 20 characters

innings, notout, runs integer type

batavg it is calculated according to the formula
batavg =runs/(innings-notout)

calcavg() Function to compute batavg

Public members:
readdata() Function to
accept value from bcode, name, innings,
notout and invoke the function calcavg()

displaydata() Function to display the data members on the screen.
Wtite a C++ program to demostrate how the functions work.

Last edited on
Topic archived. No new replies allowed.