Thread: help me to recode my program please....

  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をこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    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をこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    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をこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    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をこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Don't post multiple threads containing basically the same question.
    http://cboard.cprogramming.com/showthread.php?t=101162
    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.

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, 01: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, 01:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM