Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 132,627 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,053 people online right now. Registration is fast and FREE... Join Now!




Large Integer Class

 
Reply to this topicStart new topic

Large Integer Class

girl-2006
post 30 Mar, 2006 - 02:44 PM
Post #1


New D.I.C Head

*
Joined: 30 Mar, 2006
Posts: 2


My Contributions


hello for all

I happy to be with you and deal with u rolleyes.gif

but I have question ... it is difficult blink.gif

I hope anyone help me


Create a HugeInteger class that uses a 40 element array of digits to store integers as large as 40 digits each. Provide member functions input, output, add and subtract. For comparing HugeInteger objects, provide functions isEqualTo, isNotEqualTo, isGreaterThan, isLessThan, isGreaterThanOrEqualTo, isLessThanOrEqualTo these functions return true if the relationship holds between the two HugeIntegers and returns false if the relationship does not hold.

Write a menu-drive program that tests all the functionalities in this class.

smile.gif
User is offlineProfile CardPM

Go to the top of the page

Amadeus
post 30 Mar, 2006 - 03:06 PM
Post #2


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 12,176



Thanked 33 times

Dream Kudos: 25
My Contributions


The site has a policy by which we are more than happy to help users with their academic assignments, but we do require that some good faith effort is shown by the user. If you could please post the code you have written in an attempt to solve this assignment, we would be pleased to provide some guidance.
User is offlineProfile CardPM

Go to the top of the page

girl-2006
post 31 Mar, 2006 - 07:55 AM
Post #3


New D.I.C Head

*
Joined: 30 Mar, 2006
Posts: 2


My Contributions


I can't read arry go on ( inside ) the object ,,,, and I don't know to use
overloding (> ,< ,!= ,== ) truthly . smile.gif

but this is that i write and I can to arrive to it


here
#include<iostream>
#include<string>
#include<ctype.h>
using namespace std;
using std::istream;
using std::ostream;
class samp {
int n,m,o;
public:
samp (int i=0,int l=0,int j=0 )
{
n=i;
m=l;
o=j;
}

samp operator+(samp ob)
{
samp temp;
temp.n=n+ob.n;
temp.m=m+ob.m;
temp.o=o+ob.o;
return temp;
}

samp operator-(samp ob)
{
samp temp;
temp.n=n-ob.n;
temp.m=m-ob.m;
temp.o=o-ob.o;
return temp;
}
bool operator==(samp ob);

void print()
{
cout<<n<<" "<<m<<" "<<o<<"\n";
}
};
bool samp::operator ==(samp right)
{
if(n==right.n&&m==right.m&&o==right.o)
return true;
else
return false;
}



int main()
{
int choice;
samp A(1,2,3);
samp B(3,2,1);

cout<<"\n";

samp C;
while (choice!=2)
{
cout<<"what do you want to do..\n";
cout<<"1-Add two object..\n";
cout<<"2-Subtract two object..\n";
cout<<"3-com two object..\n";
cout<<"4-Exit..\n";
cout<<" SELECT" ;
cin>>choice;
switch(choice)
{
case 1:
C=A+B;
C.print();
break;
case 2:
C=A-B;
C.print();
break;
case 3:
A==B;
case 4:
break;
default:
cout<<" Invalid choice !\n";
}
cout<<endl<<"---------------------------------------------";
}

return 0;
}
User is offlineProfile CardPM

Go to the top of the page

Reply to this topicStart new topic
Time is now: 11/23/08 03:35AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month