Thread: Functions

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    1

    Functions

    I tried making a function to get used to them, but this code does not work. What's wrong with it?

    Code:
    #include <iostream.h>
    int mult(int x);
    int main()
    {
      int x;
      cout << "Please give a number for 'X'";
      cin >> x;
      cout << "X + 1 is " << mult(X);
      return 0;
    }
    int mult(int x)
    {
      return x;
    }
    thanks alot for any help

  2. #2
    Registered User
    Join Date
    Jul 2002
    Posts
    47
    You just have a typo

    This Line is WRong!!
    Code:
     cout << "X + 1 is " << mult(X);
    Remember case sensitive;
    Code:
     cout << "X + 1 is " << mult(x);
    Make the x lowercase

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Void Functions Help
    By bethanne41 in forum C++ Programming
    Replies: 1
    Last Post: 05-09-2005, 05:30 PM
  2. Functions and Classes - What did I do wrong?
    By redmage in forum C++ Programming
    Replies: 5
    Last Post: 04-11-2005, 11:50 AM
  3. calling functions within functions
    By edd1986 in forum C Programming
    Replies: 3
    Last Post: 03-29-2005, 03:35 AM
  4. Factory Functions HOWTO
    By GuardianDevil in forum Windows Programming
    Replies: 1
    Last Post: 05-01-2004, 01:41 PM
  5. Shell functions on Win XP
    By geek@02 in forum Windows Programming
    Replies: 6
    Last Post: 04-19-2004, 05:39 AM