Search:

Type: Posts; User: Therry

Page 1 of 2 1 2

Search: Search took 0.00 seconds.

  1. Replies
    13
    Views
    5,435

    Sorry guys, I got the answer that I was looking...

    Sorry guys, I got the answer that I was looking for. Instead of pressing return after each >> just use a space until the last input like:


    x [space] x [space] x [space] x {enter]

    and it will...
  2. Replies
    16
    Views
    2,051

    OK, I commented out the troubling if (!...

    OK, I commented out the troubling


    if (! d_file )
    {
    cout << "Can't open input file " << endl << endl;
    cin.get();
    exit(1);
    }
  3. Replies
    16
    Views
    2,051

    I understand that if (! d_file ) ...

    I understand that




    if (! d_file ) { cout << "Can't open input file " << endl << endl; cin.get(); exit(1); }

    only checks to see if the file is opened by:
  4. Replies
    13
    Views
    5,435

    Sorry, but it is you who have missed the point of...

    Sorry, but it is you who have missed the point of my question. I know that the standard way of a cin is always with a new line. What I'm asking is there a way to override the '/n' in the output by...
  5. Replies
    13
    Views
    5,435

    Independent of the instruction, if I code cin...

    Independent of the instruction, if I code
    cin >> aa >> bb >> cc >> dd; It is the same as


    cin >> aa;
    cin >> bb;
    cin >> cc;
    cin >> dd;
  6. Replies
    16
    Views
    2,051

    I'm sorry about being so thick here, but I do not...

    I'm sorry about being so thick here, but I do not understand your question? The code that you quoted is the new data that I wish to write/append into the file. Are you implying that I should use...
  7. Replies
    13
    Views
    5,435

    There seems to be a misunderstand here. I did not...

    There seems to be a misunderstand here. I did not ask how to read the statement into code. I already coded the statement.
    cin >> aa >> bb >> cc >> dd;in my program and it worked just fine. I asked...
  8. Replies
    16
    Views
    2,051

    Sorry, that did not work. It is true that the...

    Sorry, that did not work. It is true that the addition of * std::ios::app* caused the program to stop erasing the content of the file, but the file is still not up-dated with the new data. What am I...
  9. Replies
    13
    Views
    5,435

    Printing more than one cin>> statements

    How does one get more than one *cin >>* statements to write out on the same line?
    I want it written as
    "x x x x MB x" instead of:


    x
    x
    x
    x
    MB
  10. Replies
    16
    Views
    2,051

    Thanks nimitzhunter...

    Thanks nimitzhunter http://im.cprogramming.com/images/statusicon/user-online.png, That's what I needed. I forgot that.
  11. Replies
    16
    Views
    2,051

    Thanks. I am opening the file to write the...

    Thanks. I am opening the file to write the numbers with the highest frequencies, then reopening the file to write the numbers having the lowest frequencies. I was tole that I have to close the file...
  12. Replies
    16
    Views
    2,051

    The following code worked just fine. ...

    The following code worked just fine.



    ofstream d_file ( "D:\\1_LotteryPrograms\\1_Fla_Mega_Money\\High_Freq.txt" );


    if (! d_file )
    {
    cout << "Can't open input file " << endl << endl;
  13. Replies
    16
    Views
    2,051

    Revisited an old problem

    Sorry to revisit this subject, but I have another question with I/O files. Do I need to have both *ifstream* & *ofstream* statements in order to reopen a file? The first part worked just fine, but...
  14. Replies
    2
    Views
    877

    Insertion sorting programs

    Hi all,
    My next project in my self-teaching of C++ is sorting programs. I have chosen -- Selection sort -- as my teaching device.

    I've chosen this code for a simple selection sort because I...
  15. Replies
    12
    Views
    1,162

    WOW!. . . . Thanks for your patience!

    WOW!. . . . Thanks for your patience!
  16. Replies
    12
    Views
    1,162

    Are you saying that I must close the file...

    Are you saying that I must close the file "Highest_Frequencies.txt" each time I've finished writing to it?
    Is that the only safe way to recall/reopen the file to append it?
    I did not know this. I...
  17. Replies
    12
    Views
    1,162

    I took your suggestion and replaced both: ...

    I took your suggestion and replaced both:



    ofstream f_file ( "D:\\1_LotteryPrograms\\1_Fla_Mega_Money\\Highest_Frequencies.txt" );
    ofstream out1;...
  18. Replies
    12
    Views
    1,162

    My code is: ifstream e_file (...

    My code is:


    ifstream e_file ( "D:\\1_LotteryPrograms\\1_Fla_Mega_Money\\Highest_Frequencies.txt" );

    if (!e_file )
    {
    cout << "Can't open input file" << " Highest_Frequencies.txt " << endl <<...
  19. Replies
    12
    Views
    1,162

    Sorry, this newbie is really slow when it comes...

    Sorry, this newbie is really slow when it comes to C++.



    Are you suggesting that I replace line 8 with lines 10 & 11?
  20. Replies
    12
    Views
    1,162

    // will probably fail because the file is already...

    // will probably fail because the file is already open

    It's does me no good it it fails, how can I do it so that is does not fail?
  21. Replies
    12
    Views
    1,162

    Where to put ios::app?

    Sorry to be such a dummy, but exactly where would you put:


    ofstream out1;
    out1.open("D:\\1_LotteryPrograms\\1_Fla_Mega_Money\\Highest_Frequencies.txt", std::ios::app);

    to append my file? My...
  22. Replies
    2
    Views
    911

    About appending to a file

    Hi all
    I have a different problem now -- trying to use "ios::app".

    I understand it is what you use to append to a file, but where is it placed?

    in
    ifstream a_file ios::app?

    in
    ofstream...
  23. Replies
    7
    Views
    3,765

    WoW, thanks. I got it working! Thanks everyone.

    WoW, thanks. I got it working! Thanks everyone.
  24. Replies
    7
    Views
    3,765

    Sorry to be such a dunce, I'm not sure I...

    Sorry to be such a dunce, I'm not sure I understand. Could you give ma an example?
  25. Replies
    7
    Views
    3,765

    Illegal Charactors

    I changed it like this:


    // displays 1st, 2nd, 3rd, and 4th highest frequencies

    cout << indexoffirst << " = "<< first << endl << endl;
    cout << indexofsecond << " = " <<...
Results 1 to 25 of 40
Page 1 of 2 1 2