Writing a Program to Divide Numbers - Help Needed

Click For Summary

Discussion Overview

The discussion revolves around writing a program in C++ to divide a number by a list of other numbers and print the results, including remainders. Participants explore programming challenges and seek assistance with specific coding issues.

Discussion Character

  • Homework-related
  • Technical explanation

Main Points Raised

  • Dan seeks help in writing a program that divides a number by a list and prints the results with remainders.
  • Warren suggests selecting a programming language as a first step.
  • Dan mentions using an older version of C++ and has made some progress but encounters two specific problems: resetting the program with a button press and issues with printing large integer values.
  • Another participant advises Dan to consult a manual for C++ to better understand the language's requirements and methodologies.
  • There is an implication that learning the language will help Dan complete the task quickly.

Areas of Agreement / Disagreement

Participants generally agree on the importance of understanding the programming language, but there are no explicit resolutions to Dan's specific coding problems.

Contextual Notes

Dan's issues with resetting the program and handling large integers remain unresolved, and the discussion does not clarify the specific coding methods or functions needed to address these problems.

carterw
Messages
5
Reaction score
0
Hello.

I would like to write a program into which I can input any number, say 11133, and divide this by a list of numbers, say 543, 345, 2368...
and have the program print the list of results, integers only, with the remainder.

I imagine this is a fairly simple program to write, but I am still unfamiliar as yet with what steps to take to begin. Would anyone be able to help. Thanks in advance.

Dan
 
Computer science news on Phys.org
First, select a language.

- Warren
 
Hi Warren,

Thanks,
I have started using a '94 version of C++,
are you familiar with this?
I managed to get a useful program working.

Two problems though that I have not been able to find solutions to yet.

1) How do i get it so the program resets at the press of a button so I don't have to keep exiting and entering again?

2) Even though I am using "long" integers throughout, the program will not print values better than about 250 000. beyond this I just get garbled data.

Thanks,
Dan
 
carterw,

If C++ is your language of choice and you don't have a manual explaining the coding requirements, then I would recommend that you do that first. You don't have to read the book from cover to cover, but, understand the overall methodology of the language and focus on the sections that address the specific functions you need. Anytime spent learning a language such as an all purpose tool like C++, is time well spent.

You are right. Once you review the manual, this job should take only a few minutes to complete.
 
Last edited:

Similar threads

  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 49 ·
2
Replies
49
Views
5K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 22 ·
Replies
22
Views
6K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K