Would this be considered as a Subrountine problem? My program runs but I feel like it is missing something else.

#include <iostream>
using namespace std;
void getData(int, int, int);
 int main()
 {
    int x,y,z;
    cout << "Please enter first number: ";
    cin >> x;
    cout << "Please enter second number: ";
    cin >> y;
    z = x * y;
    cout << "Answer is " << z;

    cout << "\n\nPlease enter first number: ";
    cin >> z;
    z = z+5.0;
    cout << "\nAnswer is: " << z;
    return 0;
    }

My program runs but I feel like it is missing something else.

Yes, you're missing the subroutine. Declaring a function is only half of process, you also need to define the function and tell it how it works:

#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(5, 2) << '\n';
}

// Definition: Tells the compiler what a function does
int multiply(int x, int y)
{
    return x * y;
}
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.