Thread: Program that fixes sentence case.

  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    2

    Program that fixes sentence case.

    Hello, I just joined, hope I'm doing this right....!

    So, for my computer programming class, we have to write a few programs for each assignment. Programming is just over my head - I'm awful with computers. I was wondering if I could get some assistance here. ^^;...

    We need to write a program that will take a sentence and put it in lowercase and capitalize what is appropriate (like the first letter after a period or an exclamation point).

    This is what I have so far...

    Code:
    #include <stdio.h>
    
    
    int main()
    {
        int firstletter = 0;
    
    
        while ((c = getchar())) !=EOF)
        {
        if (firstletter == 0)
        {
            upper = toupper(c)
            putchar(upper)
            firstletter++;
        }
        }
    
    
    
    
    return 0;
    
    
    }
    I got some help from someone and this is what we came up with. It capitalizes the first letter right? I find this all so hard to understand... Thanks for taking the time to look at my problem.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    > So, for my computer programming class, ... Programming is just over my head - I'm awful with computers
    You're on this course because?

    And who is "we"?

    > capitalize what is appropriate (like the first letter after a period or an exclamation point).
    So think about
    if ( c == '!' || c == '.' )
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Mar 2012
    Posts
    2
    The course is required for my program.

    Okay, thanks for the suggestion.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program to count parts of a sentence
    By dustynlily in forum C Programming
    Replies: 11
    Last Post: 02-20-2012, 09:01 PM
  2. Here is my Sentence Analyzer Program!
    By jeremy duncan in forum C Programming
    Replies: 7
    Last Post: 01-02-2012, 12:04 PM
  3. Replies: 2
    Last Post: 12-02-2011, 09:19 PM
  4. Help with Sentence fix string program
    By daywalker- in forum C++ Programming
    Replies: 9
    Last Post: 11-01-2007, 06:44 AM
  5. My calculator program. Final fixes.
    By SlyMaelstrom in forum C++ Programming
    Replies: 7
    Last Post: 05-13-2004, 09:41 PM