Another program with more problems.

This is a discussion on Another program with more problems. within the C++ Programming forums, part of the General Programming Boards category; Ok, this is a different program and I can't seem to get this program to work. It's the function that ...

  1. #1
    1479
    Join Date
    Aug 2003
    Posts
    253

    Angry Another program with more problems.

    Ok, this is a different program and I can't seem to get this program to work. It's the function that wont work.

    Code:
    #include <iostream>
    using namespace std;
    
    
    int Add(int firstNUM, int secondNUM)
        {
        cout <<"Tn the function now!" <<endl;
        cout <<"The number " <<firstNUM << " and the number " <<secondNUM << " will now be added together" <<endl;
        cout <<firstNUM <<" + " <<secondNUM <<"is the equation." <<endl;
        return (firstNUM+secondNUM);
        }
    int main()
    {
    int firstNUM, secondNUM, sumNUM;
    
    cout <<"This is a function program, just checking to see how good I know functions." <<endl;
    cout <<"Enter a number" <<endl;
    cin >>firstNUM;
    cout <<"Enter another number" <<endl;
    cin >>secondNUM;
    sumNUM = Add(firstNUM,secondNUM);
    cout <<Add();
    
    system("pause");
    
    return 0;
    }
    Can anyone help me out here?
    Knowledge is power and I want it all

    -0RealityFusion0-

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    try:

    cout << Add(firstNUM,secondNUM) << endl;
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3
    Registered User
    Join Date
    May 2002
    Posts
    66
    Code:
    #include <iostream>
    using namespace std;
    
    
    int Add(int firstNUM, int secondNUM)
    {
      cout << "Tn the function now!" << endl;
      cout << "The number " << firstNUM << " and the number " << secondNUM << " will now be added together" << endl;
      cout << firstNUM << " + " << secondNUM << "is the equation." << endl;
      return (firstNUM+secondNUM);
    }
    
    int main()
    {
      int firstNUM, secondNUM, sumNUM;
    
      cout << "This is a function program, just checking to see how good I know functions." << endl;
      cout << "Enter a number" <<endl;
      cin >> firstNUM;
      cout << "Enter another number" << endl;
      cin >> secondNUM;
      sumNUM = Add(firstNUM,secondNUM);
      cout << sumNUM;
    
      return 0;
    }
    Calling cout << Add() is the error...

  4. #4
    1479
    Join Date
    Aug 2003
    Posts
    253
    Thank You both!
    Knowledge is power and I want it all

    -0RealityFusion0-

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 01:42 AM
  2. Problems with DLLEXPORT while updating a program
    By pirata in forum C++ Programming
    Replies: 3
    Last Post: 09-05-2008, 01:00 PM
  3. having problems with my card program
    By mac025 in forum C Programming
    Replies: 4
    Last Post: 01-31-2006, 03:26 PM
  4. structure problems in windows program.
    By Bajanine in forum Windows Programming
    Replies: 3
    Last Post: 04-19-2004, 06:18 PM
  5. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 11:39 AM

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