if I understand properly you want to decrease the subtrahend by 3 every time and subtract it from your current result. To do that add another variable called subtrahend and initialise by 25. Each round of the loop decrease the subtrahend after you subtracted it from i.
using namespace std;
int subtrahend = 25;
you are only decrementing by one. You seem to want to start yuor decrement at 25, and then subtract the decrement by 3 each time (i.e. subtract 25; subtract 22; subtract 19) as stated by the desired output you wish to recieve. try using this code here in place of your while loop:
int j = 25; //this is what you will be decrementing by.
while(i >= 3)
cout << ' ' << i;
i = i - j; //decrement by 25,22,19,etc...
j = j - 3;//this is your other decrementnc counter, used to
also, these lines here:
i = i - j;
j = j - 3;
can also be written as such:
i -= j; //same as i = i - j
j -= 3; //same as j = j - 3
hope this helps. :)
EDIT: drkybelk got to this one before me ;)
Edited 5 Years Ago by Derek Elensar: drkybelk posted before me.
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.
I am writing a java program that needs to execute shell commands, so I wrote a function that would take the command to execute as a string (ie: "mkdir ~/Folder1") and execute that command with the shell. Here is the function:
Runtime run = Runtime.getRuntime();
Process pr = ...
Hey, so I wanna ask how I need to create a method who will remove word if in that word is 2 same chars. Example: "Potato" in this word there is a 2 "o" chars so this word will need to be removed. "Forum" in this word there is no ...