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..
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..
psuedo
Code:int val = 1 loop{ //do stuff here if val = 23{ val = 0 } val = val + 1 }
Woop?
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
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.
Woop?
can other person help me about this..
thnx anyway...
What part of prog-bman's pseudocode do you have problems understanding?can other person help me about this..
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
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
^Is me being too nice but whateverCode:#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; }
Last edited by prog-bman; 05-25-2006 at 01:28 AM.
Woop?
cool.. ...............
Sorry, prog-bman, your solution is wrong. The specification does not allow for printing the numbers to screen, and requires an infinite loop.Is me being to nice but whatever
A correct solution would be:
Code:int main() { for (;;) for (int i = 1; i <= 23; ++i); }
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
I wasn't going to write his code for him just give a general idea
Woop?
Well, now I can claim to be 'nicer' than youI wasn't going to write his code for him just give a general idea
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
You sure are
Woop?
Hey, laserlight, check out this link!
lolHey, laserlight, check out this link!
I see you've clicked this link before!
Closed.