Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <iostream>

using namespace std;

int main()
Expand All @@ -10,14 +12,31 @@ int main()
{
cout<<"Enter a whole number: \n";
cin>>num1;

while (!(cin >> num1)) // <<< note use of "short circuit" logical operation here
{
cout << "Please enter the number " < endl;
cin.clear();
cin.ignore(); // NB: preferred method for flushing cin
}


cout<<"Enter another whole number: \n";
cin>>num2;
while (!(cin >> num2)) // <<< note use of "short circuit" logical operation here
{
cout << "Please enter the number " < endl;
cin.clear();
cin.ignore(); // NB: preferred method for flushing cin
}

if( num1 = num2 )
if( num1 == num2 )
{
cout<<"Numbers should be different!\n";
repeat = true;
}
else
repeat = false;
}while(repeat);

cout<<"Increasing order: ";
Expand All @@ -32,4 +51,3 @@ int main()

return 0;
}