Help me

This is a discussion on Help me within the C Programming forums, part of the General Programming Boards category; Ok here is what I am supposed to do. Now what I need is to know how to get the ...

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    57

    Thumbs up Help me

    Ok here is what I am supposed to do. Now what I need is to know how to get the stuff out of that file so I can perform my tests and changes to it.

    Assume that a student is typing his/her final report for English class into a
    text file "report.txt". After completing the report, the student realizes that
    he/she mistakenly had the Caps Lock key on throughout the typing process. All
    the Latin characters in the report are, therefore, in uppercase. Since the
    report is very (very) lengthy, the student has decided to write a C program
    that would make the report better by converting all the Latin uppercase letters
    to lowercase letters. Since this is a report for English class, the program must
    also ensure that each sentence starts with an uppercase letter, but otherwise,
    the file contains only lowercase letters. The program assumes that sentences are
    seperated by either a full stop (.) character, or a exclamation mark (!) character,
    or a query (?) character, each followed by whitespace (as defined for Assignment 3).

    For example, assume that the original file "report.txt" contained the following
    text:

    ASSUME THAT A STUDENT IS TYPING HIS FINAL REPORT FOR ENGLISH CLASS
    INTO A TEXT FILE. AFTER COMPLETING THE REPORT, HE REALIZED THAT
    HE MISTAKENLY HAD THE CAPS LOCK KEY ON THROUGHOUT THE TYPING PROCESS. HE SAID
    OH MY GOSH WHAT HAVE I DONE? HOW AM I GOING TO FIX THIS? BUT THEN HE KNEW C.
    SO HE SAID I WILL WRITE ME A C PROGRAM.

    After running your program, the corrected file "report.txt" would contain the
    following text:

    Assume that a student is typing his final report for english class
    into a text file. After completing the report, he realized that
    he mistakenly had the caps lock key on throughout the typing process. He said
    oh my gosh what have i done? How am i going to fix this? But then he knew C.
    So he said I will write me a c program.

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Sounds like you want us to do your homework for you....this wouldn't be CS120 would it? What are you stuck on , opening the file?

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    57
    If i can have someone show me how to open it. I'm sure I can do the rest just fine.

  4. #4
    CS Author and Instructor
    Join Date
    Sep 2002
    Posts
    511
    Sound like you are not reading from a text file but writing out to text file so... (may be wrong about this assumption)

    Code:
    FILE *infile;
    
    infile = fopen("a:\\report.txt","w");
    
    ...
    now go from here

    Also, why don't you use a textbook or tutorial on the web to help as well?
    Mr. C: Author and Instructor

  5. #5
    Registered User
    Join Date
    Oct 2002
    Posts
    57
    I am. I just wanted to make sure.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21