Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    GIF shows where to locate </> in the thread and or post editor toolbar.
    To learn more about how to use our BBCode feature, review our "How to post your code into threads" here.

    Thank you, Code Forum.

C++ code that would calculate when the positives are twice as much as the negatives

hendyies

Coder
so i have to create a program as follows: ''15. Generate numbers between -35 and 70 until the sum of the positive numbers is at least twice the sum of the negative numbers, regardless of the sign, or absolute value. Output all generated numbers in 6 columns and results. The generated numbers can be replaced by entering numbers, but it must be checked that the entered number is within the specified range. "
--------------------------
i think i can handle some of that and make it myself, although i am extremely lost at how to make it understand when the positives are twice as much as negatives, also in the task there are 2 approaches, either i generate numbers until its positives are 2x as much as negatives, or enter them myself and make the program loop to allow me to keep entering them until its 2x as much as negatives
1. how would i get it to generate not just numbers above 0 but also negative numbers if using the generate numbers approach?
2. if im entering the numbers myself, how do i make it infinite so that theres not just 5 numbers i can enter before the program finishes, and how do i get them all to be checked for being within the -35 to 70 interval?
p.s if someone does help, can they also show an example of how to do it, because i'm quite slow with programming. much appreciation!

---------------------------
this program is due tomorrow, can someone help me? (fyi im not studying to be a programmer but someone who builds pcs and such, although programming is something im supposed to do in the first year as a side class, and i'm not too good with it.)
 
Back
Top Bottom