# Thread: Loop Loop...

1. ## Loop Loop...

hi everyone,

can someone give me some hints on how to loop the number from 1 to 23 and after that start from 1 - 23 again and start over again..

thank you..

2. psuedo
Code:
```int val = 1

loop{
//do stuff here
if val = 23{
val = 0
}
val = val + 1
}```

3. hi, i dont understand ur code as i am newbie of c++..

my aim is to produce the day of the physical cycle for biorhythm.

physical day has 23 per cycle...

hope you understand

4. That was psuedo code. Meaning it wasn't language specific. This is a very simple logic problem and I basically just handed the answer to you so I really don't see the problem.

5. can other person help me about this..
thnx anyway...

6. can other person help me about this..
What part of prog-bman's pseudocode do you have problems understanding?

7. What do you want someone to do your work for you?
I am sorry you can't figure out such a simple problem. Obviously my efforts were horrible and you being the genius you are, my feeble efforts are too simple for you to understand so please someone who is more intelligent than I help peter with his ultra difficult logic problem.

C++ Code
Code:
```#include <iostream>

int main()
{
//This will loop through 1-23 10 times
//I am suprised I know how to do this
int iters = 0;
for(int i = 1; iters < 10; i++){
std::cout<<i<<" ";
if(i == 23){
i = 0;
iters++;
std::cout<<std::endl;
}
}
std::cin.get();
return 0;
}```
^Is me being too nice but whatever

8. cool.. ...............

9. Is me being to nice but whatever
Sorry, prog-bman, your solution is wrong. The specification does not allow for printing the numbers to screen, and requires an infinite loop.

A correct solution would be:
Code:
```int main()
{
for (;;) for (int i = 1; i <= 23; ++i);
}```

10. I wasn't going to write his code for him just give a general idea

11. I wasn't going to write his code for him just give a general idea
Well, now I can claim to be 'nicer' than you

12. You sure are

13. Hey, laserlight, check out this link!

14. Hey, laserlight, check out this link!
lol

15. I see you've clicked this link before!

Closed.

Popular pages Recent additions