473,761 Members | 7,351 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with simple C Math program

2 New Member
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
1 2075
JosAH
11,448 Recognized Expert MVP
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

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

Similar topics

20
3125
by: drs | last post by:
Hi, I am trying to find all lists of length x with elements a, b, and c. To this end, I have created the class below, but it is not quite working and I am having trouble figuring out what to change. Does anyone have any insight? class c: def __init__(self): self.traits = 4 # number of list elements self.types = 3 # elements can be 0, 1, or 2
38
2529
by: Jordi | last post by:
I have made a little C program that generates the following output: 227.000000 / 5 = 45.400002 Here's the code: int main (int argc, char* argv) { float var = 227; printf("%f / 5 = %f\n", var, var / 5); return 0; }
6
2678
by: toch3 | last post by:
i am writing a c program that is basically an address book. the only header we are using is #include<stdio.hwe are to use a global array, loops, and pointers. we are to have a menu at the beginning. 1. add new record 2. search for a record 3 modify a record 4. delete a record 5. view all records 6.exit in each of these menu's we are to be able to print the record to an exterior printer. : i have started my global array, and program, but...
3
5260
by: knightsmastergeneral | last post by:
Hi, I'm currently working on getting junit and junireport to take some java files, convert it to xml and then display error messages / success rates etc in html which is one of the features of junitreport. I created a simple Math.java class which contains: package test; public class Math { public int add(int a, int b) { return a + b; }
11
2076
by: frankie_85 | last post by:
Hi everyone, I just made a simple code which is part of my assignment but I can't figure it out what's wrong with it. (always give me error messages) What the code basically does is: a function that takes one floating point number x as its argument and returns (the square root of the absolute value of x) plus (5 times x cubed).
0
5573
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
0
3192
by: SOI_0152 | last post by:
Hi all! Happy New Year 2008. Il hope it will bring you love and happyness I'm new on this forum. I wrote a stored procedure on mainframe using DB2 7.1.1 and IBM language c. Everything works fine. Now we decided to move from mainframe IMS-DB2 to Windows 2003 server-DB2 UDB for LUW 9.5.
4
1962
by: sharptool | last post by:
Please, please, please make suggestions on how to resolve these errors. I am trying to build a program that computes a, b, c for the quadratic equation but I'm not having any luck. It's been 5 hours and I've only manage to clear 4 of my errors. Please note the primary focus is to use function calls. The main function needs to pass the coefficients to a function root1 that computes and returns the value of x1 to the main. I am trying to do...
10
4650
by: yeshello54 | last post by:
Hey guys i am pretty new to java swing and need some help. I am developing a simple color chooser program in swing. I have a color panel that is connected to three sliders. red green and blue. but for some reason i cant get it to work..i will post my code and if anyone has any insight to why my changelistener wont work correctly I would really appreciate it. Thanks. import java.awt.*; import java.awt.event.*; import javax.swing.*; import...
0
10111
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9948
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9902
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9765
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8770
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7327
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6603
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5364
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.