From: kalum AT mycabin DOT com Message-ID: <37C6842800155803@mypad.MYPAD.COM> (added by postmaster@mypad.MYPAD.COM) To: djgpp AT delorie DOT com Subject: Re: Problem with while-loop Date: Sun, 5 Sep 99 08:11:14 +0000 X-Mailer: Endymion MailMan Standard Edition v3.0.2 Reply-To: djgpp AT delorie DOT com > First of all, I'm a beginner in C++ and I hope I am at the right place > in this newsgroup. > I bought a book on learning C++ and along with it I got a copy of > the GNU-C++ Compiler V. 2.7.2.1 for DOS from DJGPP. > In the book there was a sample program introducing encapsulated > while-loops. A turning line (\|/-) should be shown on the screen. > Now my problem is, the program doesn't seem to do anything ! > It compiles without any problems, but when I execute it, it shows > nothing on the screen. > After I finally use to stop the programm, only the last > charakter (e.g.: "\") is shown. > I took the source code right from the CD I got with my book, so there > can't be any typing errors. > On the CD there is also an executable program, which runs perfectly ! > > Does anybody have a clue what might be the problem ? > > I enclosed the following things : - my environment variables > environ.lst > - compiler startup messages go32.lst > - the problematic source code rotsl.cpp Kalum AT mycabin DOT com replied, My friend your attachement looked so distorted, i think it might have been sent through a word processor wich caused huge distortions like line wrapping before it was put on the CD. It would be a good idea to check the rotsl.cpp example in the book and see whether it matched the rotsl.cpp wich you attached to your email. I suggest examining other examples and seeing wether this is indeed the case. In C++ a "//" means that it is a comment and the compiler ignores anything on the sameline after it. for example note that in the following line printf("1"); //printf("2"); the printf("2") will be ignored. So following the distortions several lines of your code are being commented out. //Anyway I rearranged your code so that it looks like this. #include // printf void main() { double cnt; while(1) // Endlosschleife { printf ("|"); // Zeichen ausgeben cnt = 0.0; // Z„hlvariable initialisieren while(cnt < 100000.0) // Pause cnt++; printf("\b"); // Ausgabe-Position 1 Zeichen zurcksetzen printf ("/"); // Zeichen ausgeben cnt = 0.0; // Z„hlvariable initialisieren while(cnt < 100000.0) // Pause cnt++; printf("\b"); // Ausgabe-Position 1 Zeichen zurcksetzen printf ("-"); // Zeichen ausgeben cnt = 0.0; // Z„hlvariable initialisieren while(cnt < 100000.0) // Pause cnt++; printf("\b"); // Ausgabe-Position 1 Zeichen zurcksetzen printf ("\\"); // Zeichen ausgeben cnt = 0.0; // Z„hlvariable initialisieren while(cnt < 100000.0) // Pause cnt++; printf("\b"); // Ausgabe-Position 1 Zeichen zurcksetzen } // Ende while } I hope this helps. _____________________________________________ Free email with cool domains at FriendlyEmail http://www.mypad.com/