www.digitalmars.com         C & C++   DMDScript  

c++ - cout use

reply iyer <sury1947 hotmail.com> writes:
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
parent reply Bertel Brander <bertel post4.tele.dk> writes:
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
parent reply iyer <sury1947 hotmail.com> writes:
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.
begin 644 iyers code1.txt
M(VEF9&5F(%]724Y)3PT*("` ("\J($)Y(&1E9F%U;'0L(%=I;FEO('-E=', 
M=&AE('1I=&QE(&)A<B!T;R!T:&4 97AE(&YA;64L('5S92!W:6YI;U]S971T
M:71L92!T;R!C:&%N9V4 :70 *B\-"B` ("!W:6YI;U]S971T:71L92A?7VA-

M9&5F875L="!S:&]W<R!T:&4 97AE(&YA;64L('EO=2!C86X 8VAA;F=E(&ET




M3$4 87!P;&EC871I;VXN7&XB*3L-" EP<FEN=&8H(E=R:71E('EO=7( 8V]D
M92!T;R!D;R!I+V\ :&5R92Y<;B(I.PT*"6-O=70\/")T:&ES(&ES('1O('1E


M+RH 9F]R(%=I;C,R($-O;G-O;&4 07!P;&EC871I;VYS+"!?0T].4T],12!I

M<FEN="!A('!R;VUP="!P<FEO<B!T;R!E>&ET:6YG('-O('1H870 >6]U(&-A
M;B!V:65W(&]U='!U="`J+PT*("` (&EN="!C.PT*("` ('!R:6YT9B`H(E!R
M97-S(%)E='5R;B!4;R!%>&ET.B`B*3L-"B` ("!C(#T 9V5T8RAS=&1I;BD[

`
end
Jun 22 2007
next sibling parent Walter Bright <newshound1 digitalmars.com> writes:
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
prev sibling parent reply Bertel Brander <bertel post4.tele.dk> writes:
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
next sibling parent reply iyer <sury1947 hotmail.com> writes:
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.
begin 644 iyersCONSOLE1.cpp
M+R\ 0T].4T],12YC<'` .B!M86EN(&EM<&QE;65N=&%T:6]N(&9I;&4-"B\O



M3E-/3$4-"B-I;F-L=61E(#QW
M24Y)3PT*(VEN8VQU9&4 "3QS=')I;F<N:#X +R\ 1F]R('-T<F-P>0T*(V5N


M24\ :7, 9&5F:6YE9"`J+PT*(VEF9&5F(%]724Y)3PT*("` ("\J($)Y(&1E
M9F%U;'0L(%=I;FEO('-E=', =&AE('1I=&QE(&)A<B!T;R!T:&4 97AE(&YA
M;64L('5S92!W:6YI;U]S971T:71L92!T;R!C:&%N9V4 :70 *B\-"B` ("!W

M66]U<B!A8F]U="!B;W  8GD 9&5F875L="!S:&]W<R!T:&4 97AE(&YA;64L

M("` ("` 86YD('!A<W-I;F< =&AE(')E<V5T('9A;'5E('1O('=I;FEO7V%B




M;W5R(&-O9&4 =&\ 9&\ :2]O(&AE<F4N7&XB*3L-" EC;W5T/#PB=&5S="XN




M("` >PT*("` ("\J(%!R:6YT(&$ <')O;7!T('!R:6]R('1O(&5X:71I;F< 

M("` <')I;G1F(" B4')E<W, 4F5T=7)N(%1O($5X:70Z("(I.PT*("` (&, 
A/2!G971C*'-T9&EN*3L-"B` ('T-"B-E;F1I9 T*?0T*
`
end
Jun 23 2007
parent reply Bertel Brander <bertel post4.tele.dk> writes:
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
parent iyer <sury1947 hotmail.co> writes:
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
prev sibling parent Sunny Pal Singh <sunnypal.singh impetus.co.in> writes:
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");
Better use your own 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