While Loops

#include "stdafx.h"
#include < iostream >

using namespace std;

int main()
int n = 6000000;

while (n > 0) {
cout << n << ", ";

cout << "Takeoff!\n";

Is there a way I can get it to decrease by 100's without putting 200 '-' marks
Two options:
n = (n - 100);
n -= 100;

using that many unary subtraction operators is never a good idea.
Why is it not good idea?

Wow, I'm amazed that's actually valid syntax. For future reference, don't do this. Instead, use normal assignment:
n = n - 100; //or
n -= 100;
Last edited on
It's not a good idea just because you'll have to count all those symbols to figure out how many times you are actually deprecating...
Ohhhh ya haha
i also have another question.
is there a way I could put this one code onto a flash drive and be able to plug into someone else's computer and immediately run the code?
Topic archived. No new replies allowed.