I am a bit confused in functions maybe because I am teaching myself but can any
one tell me how to write a code in which you have to input a number until the difference between two recent numbers is equal to 10. Thank you
Thank you but I think I didn't made this clear in my question but the actual code is that we have to input numbers continuously until the difference between the two latest numbers entered is 10. For example if the user enters these inputs 2, 4, 7, -3 and -15 then the output will say that the difference between -3 and -15 is greater then or equal to 10. Thank you for the reply though.
This is the start of my program now I need to write the codes in 'Diff' function which is going to determine that when the difference between the two recent entered numbers is 10. I am sorry I am just a beginner.
#include <iostream>
#include<cmath>
using namespace std;
int Diff(int num1);
int main()
{
int sum = 0;
int input;
for (int i = 0; i != 10; ++i)
{
cout << "Enter a number " << endl;
cin >> input;