Lperro Semana 12
Lperro Semana 12
Lperro Semana 12
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int x[]={20,30,40,50};
int*pt;
pt=&x[0];
for (int i = 0; i < 4; i++)
{
cout<<"La direccion del vector x["<<i<<"] es = "<<&x[i]<<endl;
}
for (int i = 0; i < 4; i++)
{
cout<<pt++<<endl;
}
cout<<"Los elementos del vector: "<<endl;
for (int i = 0; i < 4; i++)
{
cout<<"x["<<i<<"] es = "<<x[i]<<endl;
}
pt=x;
for (int i = 0; i < 4; i++)
{
cout<<*pt++<<endl;
}
getch();
return 0;
}
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int x[][3]={{5,10,15},{20,25,30}};
int*pt;
pt=&x[0][0];
for (int i = 0; i < 2; i++)
for (int j = 0; j < 3; j++)
cout<<"La dirección de x["<<i<<"]["<<j<<"] es = "<<&x[i]
[j]<<endl;
for (int i = 0; i < 6; i++)
cout<<pt++<<endl;
getch();
return 0;
}
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int x[][3]={{5,10,15},{20,25,30}};
int*pt;
pt=&x[0][0];
for (int i = 0; i < 2; i++)
for (int j = 0; j < 3; j++)
cout<<"La dirección de x["<<i<<"]["<<j<<"] es = "<<&x[i]
[j]<<endl;
for (int i = 0; i < 6; i++)
cout<<pt++<<endl;
cout<<"Los elementos de la matriz son="<<endl;
for (int i = 0; i < 2; i++){
for (int j = 0; j < 3; j++)
cout<<"\t"<<x[i][j];
cout<<endl;
}
cout<<endl;
pt=&x[0][0];
//POR PUNTEROS
for (int i = 0; i < 2; i++){
for (int j = 0; j < 3; j++)
cout<<"\t"<<*pt++;
cout<<endl;
}
getch();
return 0;
}
void invertir(int m)
{
cout<<m%10;
if(m>10)invertir(m/10);
}