This compiles but does not show me any results? Why

#include <iostream>
#include <cmath>
using namespace std;

void dist(int x1, int x2, int y1, int y2)
{
    double r1 , r2 , d ;
    r1 = sqrt((x1*x1) + (y1*y1));
    r2 = sqrt((x2*x2) + (y2*y2));
    d = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
    cout << " Distance from first point to origin :" << r1 << endl;
    cout << " Distance from second point to origin :" << r2 << endl;
    cout << " Distance between the two points:" << d << endl;
}
int main()
{
int x1, x2, y1, y2;
    cout << " Enter values for x1 x2 y1 y2\n";
    cin >> x1 >> x2 >> y1 >> y2 ;
    dist(x1, x2, y1, y2);


    char aaaa;
    cin >> aaaa;

    return 0;
}

worked for me using vs2013

 Enter values for x1 x2 y1 y2
1 2 3 4 5
 Distance from first point to origin :3.16228
 Distance from second point to origin :4.47214
 Distance between the two points:1.41421
Press any key to continue . . .

the OP doesnt have any code to pause between the output and the window closing so I would guess that was the issue.

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.