You are on page 1of 4

inicio

a=2

b=3

imprime a y b

llama a la función intercambio (a,b)

imprime a y b

fin

-----------------------------------------------------

función intercambio (x,y)

imprime x y y

temp=x

x=y

y=temp

imprime x y y

regresa

--------------------------------------------------

#include "apuntador.h"

int main ()

double a,b;

a=2;

b=3;

cout<<"a= "<<a<<endl;

cout<<"b= "<<b<<endl;

funcionIntercambio(a,b);

cout<<"a= "<<a<<endl;

cout<<"b= "<<b<<endl;

return 0;

}
-----------------------------------------------

#include <iostream>

using namespace std;

void funcionIntercambio(double apuntador1, double apuntador2);

void funcionIntercambio(double x, double y)

double temp;

cout<<"x = "<<x<<endl;

cout <<"y= "<<y<<endl;

temp=x;

x = y;

y=temp;

cout <<"x = "<<x<<endl;

cout <<"y = "<<y<<endl;

return;

----------------------------------------------------------------

//apuntador

#include <iostream>

using namespace std;

void funcionIntercambio(double *p1, double *p2);

void funcionIntercambio(double *x, double *y)

double temp;

cout<<"x = "<<*x<<endl;

cout <<"y= "<<*y<<endl;

temp=*x;
*x = *y;

*y=temp;

cout <<"x = "<<*x<<endl;

cout <<"y = "<<*y<<endl;

return;

----------------------------------------------------------------

#include "apuntador.h"

int main ()

double a,b;

a=2;

b=3;

cout<<"a= "<<a<<endl;

cout<<"b= "<<b<<endl;

funcionIntercambio(&a,&b);

cout<<"a= "<<a<<endl;

cout<<"b= "<<b<<endl;

return 0;

----------------------------------------------------------------

inicio

lee matrices A y B

multiplica matrices A y B

imprime AB

fin

inicio

leeArreglo
ordena Arreglo

imprime Arreglo

fin

You might also like