If I have an algebraic expression that makes a sequance of numbers how do I count the number of integers in the sequence and output this?

The integers are coming from a do-while loop and I don't know how to count them.

Printable View

- 05-02-2006rachael033counting number of integers in sequence
If I have an algebraic expression that makes a sequance of numbers how do I count the number of integers in the sequence and output this?

The integers are coming from a do-while loop and I don't know how to count them. - 05-03-2006major_small
just create another variable that starts at zero and increment it with each iteration of the loop:

Code:`#include <iostream>`

int main()

{

int iter=0;

do{

iter++;

std::cout<<iter<<std::endl;

}while(true);

return 0;

}