help me to recode my program please....

This is a discussion on help me to recode my program please.... within the C Programming forums, part of the General Programming Boards category; This is my first program, but my teacher ask me to recode the program that will count the number of ...

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    23

    help me to recode my program please....

    This is my first program, but my teacher ask me to recode the program that will count the number of upercase letter in a text file... I know that I have to use strlwr?? but its so confusing.. HELP ME!!
    I wish someone know this...

    Code:
    #include<stdio.h>
     void main(void)
    {
    FILE *inputf;
    char filename[40];
    nt c;
    printf("Input name of the text file");
    scanf("%s",filename);
    if (inputf = fopen(filename, "r") == NULL)
    {
    printf("ERROR: %s cannot be opened.\n", filename);
    exit(1);
    }
    while ((c = fgetc(inputf)) != EOF) fputc(c, stdout);
     fclose(inputf);
     }

    THANKS FOR THE HELP GUYS...

  2. #2
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,554
    Start by getting rid of void main (should be int main), and reading this.
    And then indenting a little better.
    And for counting upper case letters, you can use the function isupper.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User
    Join Date
    Feb 2008
    Posts
    23
    thanks for advice and link.. wait i'll try it.. but what about isupper?? how to use it?? what i know is strupr???

  4. #4
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,554
    I suggest you look in some documentation. MSDN is a great resource. Knowing how to read documentation is a very important skill to a programmer.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Registered User
    Join Date
    Feb 2008
    Posts
    23
    ='( where can I find it?? help me miss please.. I need some reference from the web not books please I dont have time to buy I'm in my rush now..

  6. #6
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,554
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    Registered User
    Join Date
    Feb 2008
    Posts
    23
    oh thanks!! i wish i could understand everything.. i wish i was intelligent as you... ok I'll read it..

  8. #8
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,554
    Quote Originally Posted by lesrhac03 View Post
    i wish i could understand everything.. i wish i was intelligent as you...
    Intelligence with the programming language and experience comes with time!
    Don't give up!
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #9
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,506
    Don't post multiple threads containing basically the same question.
    sob.. until now my program wont run...
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 12:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 12:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 09:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

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