By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,885 Members | 1,072 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,885 IT Pros & Developers. It's quick & easy.

Help with simple C Math program

P: 2
I'm new to C++ and am hoping to find help with coding a simple C program, am wanting to obtain code and functioning exe's.

I code in an old version of Visual Basic 4.0, I have a simple app that is about 3 and a half pages of code long it does some relatively simple math additions and subtractions

The problem I have is that some numbers get to be very large integers and VB automatically converts this to scientifc notation, what I need is to have all numbers added and subtracted with exact precision even when the numbers become very big, the code sums, subtracts these numbers so that in the end there is a resultant, often again a very large number

I need to be able to perform a mod function on this end resultant

here is how it will work ;

1.) The C program opens a text file, the text file contains a variable number of numbers in sequence with spaces in between them, such as

" 23 2244 87 62 71 99 8 4 9 344 21 77 87 63 98 56 64 33 22"

The number of numbers in this text file can range from only a few to hundreds

The C program scoops these out and stores and processes these as per my code in VB, but it retains the precision of the very large numbers, NOT converting these to scientific notation

2.) The end result is obtained and a mod function is used on it, the mod value can vary as well to be any number, this mod value is stored in a text file, the C program opens this text file and loads the value as a variable when ever it runs and uses that variable as the value of the mod divisor

3.) the mod value of the resultant is then printed out to a text file

Thats it!

I have the VB code and can provide it, what Im hoping for is to ask someone to convert its exact functionality, one to one to the C program

Four versions of the code needs to be made, one that adds and one that subtracts, but also from right to left and left to right... to explain better, four versions are needed;

1.) Add number sequence from left to right
2.) Add number sequence from right to left
3.) Subtract number sequence from left to right
4.) Subtract number sequence from right to left

I want to be able to call the C program from VB, so the Python dos command screen activates or at least runs and does its thing, the C program can be a simple DOS like command line style exe that just rins quickly and crunches the numbers and spits stuff out to a text file

any how, if you can let me know!

I am willing to offer some cash for this help, if it works properly but I dont have a lot of money as I am unemployed
I can offer $50.00 and can pay you via paypal

Thanks for any help you can offer
Aug 14 '08 #1
Share this Question
Share on Google+
1 Reply


Expert 10K+
P: 11,448
Note that if a, b and c can be represented exact using ints or longs so can its
mod-sum (a+b)%c == (a%c+b%c)%c so you don't need any big integer library.

kind regards,

Jos
Aug 14 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.