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-
M86EN5VYD+")#3TY33TQ%(BD[#0H ("` +RH 66]U<B!A8F]U="!B;W  8GD 
M9&5F875L="!S:&]W<R!T:&4 97AE(&YA;64L('EO=2!C86X 8VAA;F=E(&ET
M(&)Y(')E<V5T=&EN9R!?7W-Z36]D=6QE#0H ("` ("` 86YD('!A<W-I;F< 
M=&AE(')E<V5T('9A;'5E('1O('=I;FEO7V%B;W5T("HO#0H ("` <W1R8W!Y
M("A?7W-Z36]D=6QE+")#3TY33TQ%(BD[#0H ("` =VEN:6]?86)O=70H7U]S
M>DUO9'5L92D[#0HC96YD:68-"B` ("!I;G0 83L-" EP<FEN=&8H(D-/3E-/
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<W0 :6]S=')E86TN+B([#0H)8V]U=#P\(FEN<'5T('-O;64 :6YT96=E<BXN
M+B(\/&5N9&P[#0H)8VEN/CYA.PT*#0H-" EC;W5T/#QA/#QE;F1L.PT*#0H)
M+RH 9F]R(%=I;C,R($-O;G-O;&4 07!P;&EC871I;VYS+"!?0T].4T],12!I
M<R!D969I;F5D("HO#0HC:69D968 7T-/3E-/3$4-"B` ('L-"B` ("`O*B!0
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[
3#0H ("!]#0HC96YD:68-"GT-" ``
`
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
M#0HO+R!#;W!Y<FEG:'0 *&,I(%A96B!#;W)P;W)A=&EO;BP ,C`P-RX 06QL
M(%)I9VAT<R!297-E<G9E9"X-"B\O#0HO+PT*#0H-"B-I;F-L=61E"3QS=&1I
M;RYH/ T*(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"6-O=70\/&(\/&5N9&P[#0H)8V]U=#P\8SP\96YD;#L-" ES>7-T96TH
M(G!A=7-E(BD[#0H-" DO*B!F;W( 5VEN,S( 0V]N<V]L92!!<'!L:6-A=&EO
M;G,L(%]#3TY33TQ%(&ES(&1E9FEN960 *B\-"B-I9F1E9B!?0T].4T],10T*
M("` >PT*("` ("\J(%!R:6YT(&$ <')O;7!T('!R:6]R('1O(&5X:71I;F< 
M<V\ =&AA="!Y;W4 8V%N('9I97< ;W5T<'5T("HO#0H ("` :6YT(&,[#0H 
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