c++ - cout use
- iyer <sury1947 hotmail.com> Jun 21 2007
- Bertel Brander <bertel post4.tele.dk> Jun 22 2007
- iyer <sury1947 hotmail.com> Jun 22 2007
- Walter Bright <newshound1 digitalmars.com> Jun 23 2007
- Bertel Brander <bertel post4.tele.dk> Jun 23 2007
- iyer <sury1947 hotmail.com> Jun 23 2007
- Bertel Brander <bertel post4.tele.dk> Jun 24 2007
- iyer <sury1947 hotmail.co> Jun 25 2007
- Sunny Pal Singh <sunnypal.singh impetus.co.in> Jan 23 2008
Dear Group, I got the version 8.43 IDDE working. But when tried to compile cout, cin commands, it is not working. can somebody enlighten me. thanks
Jun 21 2007
iyer skrev:Dear Group, I got the version 8.43 IDDE working. But when tried to compile cout, cin commands, it is not working. can somebody enlighten me. thanks
Did you install the stl? See: http://www.digitalmars.com/faq.html#iostream How does the program you are trying to compile look? -- Just another homepage: http://damb.dk But it's mine - Bertel
Jun 22 2007
Respected Bertel sir, thank you very much for your prompt reply. I followed faq for stl. the program is enclosed. after some integers are typed and entered, the screen goes off.
Jun 22 2007
iyer wrote:Respected Bertel sir, thank you very much for your prompt reply. I followed faq for stl. the program is enclosed. after some integers are typed and entered, the screen goes off.
Open a console window and then run the program within it.
Jun 23 2007
iyer skrev:Respected Bertel sir, thank you very much for your prompt reply. I followed faq for stl. the program is enclosed. after some integers are typed and entered, the screen goes off.
You could add this at the end of the program: cin.get(); Or use: #include <stdlib.h> ... system("pause"); -- Just another homepage: http://damb.dk But it's mine - Bertel
Jun 23 2007
respected sirs, thank you very much for your guidance. now onely one charcater of input is in output. also it gives 4627144 without giving any input. help please. iyer.
Jun 23 2007
iyer skrev:respected sirs, thank you very much for your guidance. now onely one charcater of input is in output. also it gives 4627144 without giving any input. help please.
I assume that you define _CONSOLE Your variable a is of type char, so "cin >> a;" will only read one character, whether it is a number or not. If it sould be a number it must be a short, int, long or double, or variants thereof. If you type 123<enter> at the prompt, the first character ('1') will be stored in a, the rest (23) will be stored in c, without asking you to hit enter. -- Just another homepage: http://damb.dk But it's mine - Bertel
Jun 24 2007
Respected Bertel sir, thank you, I understood now. will learn more and come back. Have a nice time. god bless you. iyer
Jun 25 2007
Bertel Brander wrote:iyer skrev:Respected Bertel sir, thank you very much for your prompt reply. I followed faq for stl. the program is enclosed. after some integers are typed and entered, the screen goes off.
You could add this at the end of the program: cin.get(); Or use: #include <stdlib.h> ... system("pause");
#include <stdio.h> void myflush ( FILE *in ) { int ch; do ch = fgetc ( in ); while ( ch != EOF && ch != '\n' ); clearerr ( in ); } void mypause ( void ) { printf ( "Press [Enter] to continue . . ." ); fflush ( stdout ); getchar(); } int main ( void ) { int number; // Test with an empty stream printf ( "Hello, world!\n" ); mypause(); // Leave extra input in the stream printf ( "Enter more than one character" ); myflush ( stdin ); mypause(); return 0; }
Jan 23 2008









Walter Bright <newshound1 digitalmars.com> 