# Virtualians Social Network

Online Help, Guidance and Solutions for Virtual University of Pakistan Students

# Mobile App to Calculate Steps Using Pedometer or Accelerometer Sensor in Smart Phone Test Phase Fall 2017

Mobile App to Calculate Steps Using Pedometer or Accelerometer Sensor in Smart Phone Test Phase Fall 2017

Test phase statement

Question

The primitive data types in C++ like int, float, double etc are very powerful, but their capability of storing data is limited. Many a times there are situations where we want to store a much wider range of data than is allowed using the primitive data types, and this is where the power of C++ comes in. You have to make a class named HugeInt, which would be able to store integers upto 40 digits long.

The class should have two overloaded constructors, as follows:

HugeInt(long number);
HugeInt(char* number);

The class should have functions to add, subtract, multiply and divide HugeIntegers. The user should be able to perform the following functions:

HugeInt h1(12345), h2("123456789012345678901234567890"), h3;

h1 = h1.add(h1, h2);
h2 = h1.subtract(h2, h1);
h3 = h1.multiply(h1, h2);

and so on...Furthermore the input taken from the user should be saved in the database along with user name which you can take as input from the user.

Note that the object h1 was initialized with a long value 12345, whereas the object h2 was initialized using a c-string (this string will obviously be less than 40 digits). The object h3 is initialized with a default value of 0.

For your reference, please find below the class interface that you have to implement for the postlab assignment

class HugeInt
{
public:

HugeInt();
HugeInt(int);
HugeInt(char*);
HugeInt Add(HugeInt, HugeInt);
HugeInt Subtract(HugeInt, HugeInt);
HugeInt Multiply(HugeInt, HugeInt);
HugeInt Divide(HugeInt, HugeInt);

private:

int digits;
};

Views: 50

Attachments:

## SPONSORED LINKS 