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;
    }

Recommended Answers

All 2 Replies

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.