dear people!
i have made a program to calculate the smallest and largest of numbers trough a reference funtion.
i am stuck in a very small part. in main function i should do like if somebody dont enter anynumber or enter a number bellow 0 the program should say NOTHING TO PROCESS else it should display the result.
but this is not working here is my code in my code it displays nothing to process but also displays the result too.
#include <iostream>
using namespace std;
void determine (int &smallest, int&largest);
int main()
{
int small, large;
determine(small, large);
if(small || large<0)
{
cout <<"NOTHING TO PROCESS\n"<<endl;
}
else
cout << "Your Result:" << endl;
cout << small << ":" << large << "\n" << endl;
return 0;
}
//Function Name :determine
//Parameters :referenc, integars
//Return value :Smallest & largest visa reference
//Partners :None
//Description :This function determines the smallest and largest of numbers.
void determine ( int &smallest, int &largest)
{
int A;
A=smallest;
A=largest;
while(A>=0)
{
cout << "Please a number (Negative value to end): ";
cin >> A;
if(A<0)
return;
if (A<smallest)smallest=A;
if (A>largest)largest=A;
}
}