Bigint

Write here if you have problems with your C++ source code

Moderator: Board moderators

User avatar
Moni
Experienced poster
Posts: 202
Joined: Fri Mar 22, 2002 2:00 am
Location: Chittagong. CSE - CUET
Contact:

Post by Moni » Fri Dec 06, 2002 7:46 pm

Hai! Rajib! :lol:
Now I agree with Stefan that "Classes" are good for online contests but I want to say that they are not so good for real time contests. It will take enough time to write the routines for operator overloading for the objects which are really take you in odd situation in real time contests !!! :x
ImageWe are all in a circular way, no advances, only moving and moving!

Rajib Mazumder
New poster
Posts: 14
Joined: Fri Jul 05, 2002 7:04 pm
Location: Bangladesh
Contact:

Yes Moni Bhai

Post by Rajib Mazumder » Mon Dec 09, 2002 6:12 pm

I have the same voice with you. In Real time contests, classes are not so usefull and make difficulties when implementing them. And odd situation??? Yes we are always in odd situation in real time contest.. :oops:

zorbathut
New poster
Posts: 16
Joined: Tue Nov 05, 2002 6:31 am

Post by zorbathut » Tue Dec 10, 2002 4:03 am

Most of the time, I agree. Once in a while I find a problem is complex enough that it's worth using classes just to help organize your thoughts. Not often, but once in a while.

I've joked with friends that you can tell how hard I consider a problem by seeing how long my variable names are and how many C++ features I used.

A month or two ago I used *templates* in a problem.

That was a tough one.

suman
New poster
Posts: 45
Joined: Fri Oct 19, 2001 2:00 am
Contact:

Sometime they are blessing

Post by suman » Tue Dec 10, 2002 10:41 am

"Class" are blessing of any object oriented language. Once you write a class to do a thing, debugged, handled any odd case and then forget the inside implementation of it. Then Just use it in other time without re-thinking and re-doing it. That's why they are created.

I do agree class makes things harder in real time contest. But in some cases they may be good, if you have properly written class. Also this decision may leave impact on your contest result.

- Suman

Rajib Mazumder
New poster
Posts: 14
Joined: Fri Jul 05, 2002 7:04 pm
Location: Bangladesh
Contact:

Post by Rajib Mazumder » Tue Dec 10, 2002 4:23 pm

Yes Suman you are right in all respect but we are now a long way from solving the big int relating problems. :( [/img]

off_algos
New poster
Posts: 29
Joined: Wed Nov 13, 2002 11:37 am
Location: india

Post by off_algos » Sun Dec 29, 2002 9:24 am

well to me classes indeed are useful in solving online problems though if u can comfortably avoid using them u must.

User avatar
Moni
Experienced poster
Posts: 202
Joined: Fri Mar 22, 2002 2:00 am
Location: Chittagong. CSE - CUET
Contact:

Post by Moni » Mon Dec 30, 2002 2:21 am


If you know C++ well, you will be able to make that class and that must be well implemented too. But I have another suggestion.


Not make it BigInt class, make it BigNum class, by adding big_float data type where you can manage more precisions.

You can do that with your Integer type class too by inheriting and adding the new procedure for float operations.
ImageWe are all in a circular way, no advances, only moving and moving!

User avatar
Moni
Experienced poster
Posts: 202
Joined: Fri Mar 22, 2002 2:00 am
Location: Chittagong. CSE - CUET
Contact:

Post by Moni » Mon Dec 30, 2002 8:32 pm


Hi!
Of-course "Class" is good as it reflects OOP, but in contests (Real Time) though you have "BigInt" type class, you then can use the functions only. You don't need to write the OOP feature based codes.

But, the class need to be well implemented in sense of OOP and as well as proper memory usage and readability. I am learning Java (and C#) and I like it as a developer's language which is for internet programming and other professional works, But not suitable for contests.

C++ is a hybrid language. For contests and also for learning purpose C++ is the best I think. Because here you can learn both procedural oriented programming as well as object oriented programming. For system programming you have the power in C or Assembly Language. For AI based or expert system development I will like PROLOG as it works with clauses and logic. It's also goal oriented. And that's why it is easier than LISP as I saw LISP is full of brackets and brackets. For mathematics related problems you can use MATLAB or Maple or Mathematica type soft packs. They are good for engineering purpose.

And another important thing, don't make it habit to use the advanced routines provided by the complier or any company or internet. Try to make it yourself otherwise you will be lazy like me who is fond of ready-made codes provided by my friends. I always use my junior students to make the code for me. I make the algorithm clear to them and they do the rest for me.

Oh! Last thing, you can make your BigInt class into BigNumber class by give it the power of real value arithmetic with huge precisions. It can easily achieved by inheritance. You can inherit all the properties from BinInt class and extend it by writing procedures for real i.e. long float or double type values.

For Suman, can you extend your class? (I am lazy and this is a trick!;-) )


ImageWe are all in a circular way, no advances, only moving and moving!

Post Reply

Return to “C++”