Thread: Files using c++

  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    2

    Files using c++

    Write a program to read and write a data file. While writing data follow the following instructions:
    a)Add one space between two successive words.
    b)Capitalize the first character of sentences.
    c)If numerical data is present put them in bracket.


    please help.... i am only able to write and read the data..... but not able to perform the given instructions.......

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    So, what is your code for reading and writing the data?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Nov 2010
    Posts
    2
    cout<<"\n Enter the string.... Press '.' to exit entering:\n";
    getline(cin,s,'.');
    ofstream outfile("tony1.txt");
    for(i=0;i<s.size();j++)
    outfile.put(s[i]);
    cout<<"\n File Written.....\n";
    ifstream infile("tony1.txt");
    cout<<"\n Reading from file....\n";
    cout<<infile.rdbuf();
    cout<<endl;
    cout<<"\n Reading file complete.....\n";

    i hav used the following code.....
    Last edited by Himanka; 11-01-2010 at 11:35 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 08-11-2009, 06:45 AM
  2. Header files and multiple definitions
    By sjweinberg in forum C++ Programming
    Replies: 16
    Last Post: 07-17-2009, 05:59 PM
  3. *.cpp and *.h files understanding
    By ElastoManiac in forum C++ Programming
    Replies: 4
    Last Post: 06-11-2006, 04:45 AM
  4. Linking header files, Source files and main program(Accel. C++)
    By Daniel Primed in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2006, 11:46 AM
  5. Multiple Cpp Files
    By w4ck0z in forum C++ Programming
    Replies: 5
    Last Post: 11-14-2005, 02:41 PM