Skip to content

Instantly share code, notes, and snippets.

@krysseltillada
Created May 8, 2015 13:56
Show Gist options
  • Save krysseltillada/b2a73cbc265aa841374f to your computer and use it in GitHub Desktop.
Save krysseltillada/b2a73cbc265aa841374f to your computer and use it in GitHub Desktop.
tracking a smallest number in a loop
#include <iostream>
int main()
{
int curr_num = 0;
for(int n = 50; n <= 100; n++) {
if(curr_num == 0) {
curr_num = n;
}
else{
if(n > curr_num){
std::cout << curr_num << " is smaller than " << n << std::endl;
curr_num = n;
}
else {
curr_num = curr_num;
}
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment