Thread overview
cout use
Jun 22, 2007
iyer
Jun 23, 2007
Bertel Brander
Re: console goes off after cin entry
Jun 23, 2007
iyer
Jun 23, 2007
Walter Bright
Jun 23, 2007
Bertel Brander
Re:only one char is in output
Jun 24, 2007
iyer
Re: only one char is in output
Jun 24, 2007
Bertel Brander
thank u will learn more
Jun 25, 2007
iyer
Jan 24, 2008
Sunny Pal Singh
June 22, 2007
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
June 23, 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
June 23, 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.
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
June 23, 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.
June 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
June 24, 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.
June 24, 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
June 25, 2007
Respected Bertel sir,
thank you, I understood now.
will learn more and come back.
Have a nice time.
god bless you.
iyer
January 24, 2008
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;
}