C++ - A simple code needed - very urgent

Discussion in 'Programming' started by X P S, Feb 28, 2010.

  1. #1
    Hi, I want a very simple code. If anyone can write it for me?

    Actually I don't know any knowlege of FILE I/O in C++. I know the algorithm but can't write code.
    Please write it using just <iostream> and <fstream> classes, using the whole std namespace i.e. ( using namespace std; ) instead of writing (std::cout etc) again and again, and also without using any pre-defined function.
    I shall be thankful to you guys...
     
    X P S, Feb 28, 2010 IP
  2. killaklown

    killaklown Well-Known Member

    Messages:
    2,666
    Likes Received:
    87
    Best Answers:
    0
    Trophy Points:
    165
    #2
    stop getting others to do your homework, your gonna fail on the exam anyways.
     
    killaklown, Feb 28, 2010 IP
  3. X P S

    X P S Well-Known Member

    Messages:
    500
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    110
    #3
    hehehehhehee....
    who said this is my homeworK?

    i m not mad :D
     
    X P S, Feb 28, 2010 IP
  4. NeoCambell

    NeoCambell Peon

    Messages:
    456
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I will give you a guideline.

    1. See How to use Random Access Files in C++ and understand File Access in C++
    2. Define a structure as below.
    typedef struct abc_{
          int ID;
          char student_name[50];
          int age;
          ......
          ......
    }
    Code (markup):
    3. When you need to write a new record,
    • Fill out one instance of this structure with data
    • seek to end of file
    • Save it to file

    4. Reading a record
    • Seek to beginning of file
    • on a while loop, read to data to an instance of the structure
    • check whether the ID matches
    • exit if match, continue on loop until end of file

    I think you have everything now to start with.
     
    NeoCambell, Feb 28, 2010 IP
  5. killaklown

    killaklown Well-Known Member

    Messages:
    2,666
    Likes Received:
    87
    Best Answers:
    0
    Trophy Points:
    165
    #5
    The request you posted = assignment requirements. (I did go to college for programing, i know what an assignment looks like)
     
    killaklown, Mar 3, 2010 IP
  6. The Men

    The Men Peon

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    If it's not a homework, why does the first thread speaks the language of an assignment from your teacher ? :p
     
    The Men, Mar 4, 2010 IP
  7. NeoCambell

    NeoCambell Peon

    Messages:
    456
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #7
    If you are willing to negotiate a reasonable fee for this, you may state that, so a freelancer may contact you.
     
    NeoCambell, Mar 4, 2010 IP
  8. X P S

    X P S Well-Known Member

    Messages:
    500
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    110
    #8
    lol...a friends asked me to do that...it was his assignment :p... we didn't have studied the FILE I/O at that time...so asked... :p
     
    X P S, Jul 21, 2010 IP
  9. robotg

    robotg Member

    Messages:
    188
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    38
    #9
    your friend cannot learn with this way !
     
    robotg, Jul 21, 2010 IP
  10. X P S

    X P S Well-Known Member

    Messages:
    500
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    110
    #10
    lol...yeah..i know...i also advise him ... :D
     
    X P S, Jul 21, 2010 IP