+ 1
Wouldn't it be more efficient to write while(num<5){ cout << "The number is" << num << endl; num = num + 1; } as while(num<5){ cout << "The number is" << num++ << endl; }
2 Réponses
+ 7
Yes, for readability.
+ 1
Always keep a solution clear.
But to be honest, the given solution looks better, is easier to read and has the same runtime.
Thus the given answer would be better for a project shared with anybody.