Search Results

Search found 1 results on 1 pages for 'user363834'.

Page 1/1 | 1 

  • which is the cleaner way to do this simple while?

    - by user363834
    I'm learning c++ and I want to make clean and readable code and I was wondering which way is better (while is supposed to make the factorial of 9) : 1 - int main(){ int i = 1,r = i; while (i < 10) { r *= ++i; } 2 - int main(){ int i = 1,r = i; while (i < 10) { i++ r *= i } 1 may be harder to understand but it's 1 less line, is it worth it? and what about performance. Obviously it wouldn't matter in such a trivial example but it would be a good practice to make fast code from the begining.

    Read the article

1