Hi again; as you guys can probably guess, my teacher is not very nice. He likes saying things like "I'll leave you to figure it out" without going over something important in lecture.
Anyways, this time, I'm not looking for a solution just some general guidance because I really want to understand the how and why of this one. I've been tasked with writing a program that reads and echoes integers until the difference between two successive integers is greater than, or equal to, 10 while utilizing the function abs() to find the absolute value of the difference.
I understand that I'll need to create a function, I'm actually pretty good at that part. What's going over my head is how to make sure that said function is called with every new integer entered by the user until the difference is >= 10.
Any assistance would be greatly appreciated, especially explanation.
Thanks in advance,
X
ok lets say you have two integers int i, j;
now if the difference it 10 or greater it ends so we need a difference integer int difference;
so lets see the thought process
1 2 3 4 5 6 7
int i, j, difference;
while(true){
//get number
//difference = your function
//something to break loop
}
Thank you for your help so far, it's be great. I've got it pretty much, except that even after entering a pair of numbers I KNOW has a difference of more than 10, it requires me to enter one more pair before it will display that said difference is more than 10.