0

Im trying to get my program to do z=x*y and z=z+5.0 but not sure what I am doing wrong.

    #include <iostream>
    using namespace std;
    // Declaration: Tells the compiler how a function is called
    int multiply(int x, int y);
    int main()
    {
    // You can compile a call to the function with only a declaration,
    // but a definition is required for the code to run.
    std::cout << multiply(int x,int y) << '\n';
    }
    // Definition: Tells the compiler what a function does
    int multiply(int x, int y)
    {
    return x * y;
    }
        int addition(int z);
    int main()
    {
        std::cout << addition(5.0)<< '\n';
    }
    int addition(int z)
    {
        return z+5.0;
    }
3
Contributors
2
Replies
4
Views
4 Years
Discussion Span
Last Post by deceptikon
0

You can't have 2 main functions in one program. You either need to make 2 seperate programs or add the addition function to the first main function and get rid of the second one.

0

Why do you keep starting new threads for the same program? Please stick to one thread unless the questions are wildly different.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.