Program that fixes sentence case.

This is a discussion on Program that fixes sentence case. within the C Programming forums, part of the General Programming Boards category; Hello, I just joined, hope I'm doing this right....! So, for my computer programming class, we have to write a ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,505
    > 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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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, 08:01 PM
  2. Here is my Sentence Analyzer Program!
    By jeremy duncan in forum C Programming
    Replies: 7
    Last Post: 01-02-2012, 11:04 AM
  3. Replies: 2
    Last Post: 12-02-2011, 08: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

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