Perimetro no está declarado dentro de la main(). No se como es que te compiló
Ecá está en C++ con referencia#include <iostream>
unsigned calcular_area (unsigned base, unsigned lado, unsigned &perimetro);
using namespace std;
int main ( )
{
unsigned lado, base, p;
cout << "Dime la base de tu rectangulo: ";
cin >> base;
cout << "Dame el lado de tu rectangulo: ";
cin >> lado;
cout << "Tu area es: " << calcular_area (base, lado, p) << " y su perimetro es: " << p << endl;
cin.ignore ( );
cin.get ();
return 0;
}
unsigned calcular_area (unsigned base, unsigned lado, unsigned &perimetro)
{
unsigned area;
area = (base * lado);
perimetro = (lado * 2) + (base * 2);
return area;
}
En C++ pero con desreferencia#include <iostream>
unsigned calcular_area (unsigned base, unsigned lado, unsigned *perimetro);
using namespace std;
int main ( )
{
unsigned lado, base, p;
cout << "Dime la base de tu rectangulo: ";
cin >> base;
cout << "Dame el lado de tu rectangulo: ";
cin >> lado;
cout << "Tu area es: " << calcular_area (base, lado, &p) << " y su perimetro es: " << p << endl;
cin.ignore ( );
cin.get ();
return 0;
}
unsigned calcular_area (unsigned base, unsigned lado, unsigned *perimetro)
{
unsigned area;
area = (base * lado);
*perimetro = (lado * 2) + (base * 2);
return area;
}
Y acá está en C#include <stdio.h>
unsigned calcular_area (unsigned base, unsigned lado, unsigned *perimetro);
int main( )
{
unsigned lado, base, p;
printf ( "Dime la base de tu rectangulo: " );
printf ( "Dame el lado de tu rectangulo: " );
printf ( "Tu area es: %u y su perimetro %u", calcular_area
(base
, lado
, &p
), p
);
return 0;
}
unsigned calcular_area (unsigned base, unsigned lado, unsigned *perimetro)
{
unsigned area;
area = (base * lado);
*perimetro = (lado * 2) + (base * 2);
return area;
}
Saludos!!