+ 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; }

15th Aug 2016, 7:20 PM
Clayton Summers
Clayton Summers - avatar
2 Respostas
+ 7
Yes, for readability.
15th Aug 2016, 8:10 PM
Ahkrin
+ 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.
20th Aug 2016, 10:04 AM
Patrick Abraham
Patrick Abraham - avatar