Thread: What's wrong?

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

    What's wrong?

    Ok, I have to write a program that will change everything that is typed to capital letters. I was told to us a getChar and putChar...but i wasn't sure where to put the putChar. I am getting error messages that say that my inChar = ... is not a function. As well as my printf. So, if any one could help i would really appreciate it.
    Thanks.
    Code:
    #include <stdio.h>
    #include <ctype.h>
    int makeCap()
    {
    int inChar;
    do 
    {
    printf("Please type a sentence:\n");
    inChar = toupper(getChar());
    getChar();
    putChar(inChar);
    }
    while (inChar != 'q');

    &#91;code]&#91;/code]tagged by Salem

  2. #2
    Registered User
    Join Date
    Oct 2002
    Posts
    7
    ok, this almost works now, but it is giving me an error of: undefined reference to main.
    Code:
    #include <stdio.h>
    #include <ctype.h>
    int makeCap()
    char inChar;
    printf("Please type a sentence: \n");
    while ( (inChar = toupper(getchar() ) != 'Q')
    {
    putchar(inChar);
    }
    }
    this also says that i have only one exit status. does that mean that i need a return?

    &#91;code]&#91;/code]tagged by Salem

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    7
    i'm sorry, i am a newbie. i don't know that much about c. i am a visual learner, so if i can't see it done, i don't understand it completely. And i don't understand all of the linux lingo errors, so i am just getting the hang of it. i am sorry to ask such stupid and what must seem to you easy questions.
    i am done for now.

  4. #4
    Registered User
    Join Date
    Nov 2002
    Posts
    10

    Add on

    Ok,
    I've got a question to ask on this one. It is a really stupid one. I tried to run this program, with a few minor adjustments. It didn't stop on the letter 'q'. Why is that? I tried moving it around to different spots, but it didn't change the out put.
    thanks
    Dazed and Confuzed

  5. #5
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231

    Re: Add on

    Originally posted by ThoughtBubble
    I tried to run this program, with a few minor adjustments. It didn't stop on the letter 'q'. Why is that? I tried moving it around to different spots, but it didn't change the out put.
    Then you'd better post the code you've written. Or just review the examples already given, and compare then to your own code.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 07-15-2004, 03:30 PM
  2. Debugging-Looking in the wrong places
    By JaWiB in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-03-2003, 10:50 PM
  3. Confused: What is wrong with void??
    By Machewy in forum C++ Programming
    Replies: 19
    Last Post: 04-15-2003, 12:40 PM
  4. God
    By datainjector in forum A Brief History of Cprogramming.com
    Replies: 746
    Last Post: 12-22-2002, 12:01 PM
  5. Whats wrong?
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 07-14-2002, 01:04 PM