Selasa, 28 Juni 2011

algoritma II

Input :

#include <iostream.h>
#include <alloc.h>
void main ()
{
int *p,*q,*r ;
int m,n;
p=(int *) malloc (sizeof(int));
q=(int *) malloc (sizeof(int));
cout << "n = " ; cin >> n ;
p=&n;
*q=3+n;
r=p;
m=*r+n;
cout << m << " " << n << " " << *p << " " << *q << " " << *r << endl;
n=*q;
p=q;
r=&m;
cout << m << " " << n << " " << *p << " " << *q << " " << *r << endl;
}

Output:
n = 1
2  1  1  4  1
2  4  4  4  2





Tidak ada komentar:

Posting Komentar