Thread: An InStream has been opened but not delared...

  1. #1
    TransparentMember correlcj's Avatar
    Join Date
    Jun 2002

    An InStream has been opened but not delared...

    Assuming that inStream is opened as a connection to an input file that contains the following data:
    b=blank kay!

    b 54 b 32E1 enter -6.78 b $80 enter enter b 1 enter eof

    and the following declarations are

    int n1, n2, n3, n4;
    r1, r2, r3;
    c1, c2, c3, c4

    List the values that are assigned to each of the variables in the input list or explain why an error occurs.

    inStream >> n1 >> n2 >> c1 >> c2 >> c3
    >> r1 >> c4 >> n2 >> r2;

    I understand that inStream uses <fstream> and basically its like cin in <istream> . Am i correct to say that the >> reads a variable and skips paast the newlinw,blanks, etc.... Can anyone give me an example since the answers i have which were n1=54, n2=90 c1='E', c2='1', c3='-', r1=6.78, c4='$', n2=90 and r2=error

    A similar problem like #13 is as follows.
    inStream >> n1 >>r1 >> r2 >> c1 >> n2 >> n3;
    the books answers are:
    n1=54, r1=32E1 r2=-6.78 c1='$' n2=90 and n3=1.
    This doesn't make much sense so can anyone pls enlighten me.
    Last edited by correlcj; 10-28-2002 at 07:27 PM.
    "Be formless, shapeless, like water... You put water into a cup, it becomes the cup, you put water into a bottle, it becomes the bottle, you put it in a teapot, it becomes the teapot... Now water can flow, or it can crash, be water my friend."
    -Bruce Lee

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C Delete opened file
    By gidion in forum C Programming
    Replies: 25
    Last Post: 12-04-2008, 10:35 AM
  2. Replies: 1
    Last Post: 01-07-2007, 12:11 AM
  3. Getting opened file paths
    By geek@02 in forum Windows Programming
    Replies: 6
    Last Post: 09-18-2005, 06:53 PM
  4. inStream practice problem not working?
    By correlcj in forum C++ Programming
    Replies: 2
    Last Post: 10-27-2002, 05:58 PM
  5. Where do inStream variables get assigned?
    By correlcj in forum C++ Programming
    Replies: 0
    Last Post: 10-18-2002, 01:13 PM