El siguiente programa corre sin problemas en el Dev-C++, pero la ventana del ejecutable desaparece aún asi le haya colocado dos getchar() para evitar ese problema, de igual forma cambie los getchar() por cin.get() y tampoco funciono, la verdad no se que sucede?
-   
- #include <iostream> 
- #include <cstdlib> 
- #include <ctime> 
- #include<cstdio> 
-   
- using namespace std; 
-   
- int f; 
-   
- int aleatorio()  //Funcion para generar aleatorios para llenar la matriz 
-   
- { 
-   int r=0,z; 
-   
-   srand((unsigned) time(NULL)); 
-   
-   do{ 
-       z=rand()%20; 
-        if(z==0)r=0; 
-          else r=1; 
-   
-     }while(r!=1); 
-      return z; 
- } 
-   
- void calculos(int e[3])           //Función encargada de los calculos y procedimientos 
- { 
-    for(int i=0;i<f;i++) 
-    { 
-        e[i]=aleatorio(); 
-   
-        for(int t=i-1;t>=0;t--) 
-        { 
-            if(e[i]==e[t]) 
-            { 
-              i--; 
-   
-              break; 
-            } 
-        } 
-    } 
-   
- } 
-   
- void impresion(int g[3])   //Función que imprime los resultados. 
- { 
-  cout<<"nn"; 
-   
-   for(int m=0;m<f;m++) 
-   { 
-      cout<<g[m]<<"t"; 
-   } 
- } 
-   
- int main() 
- { 
-   int a[3]={0,0,0},b[3]={0,0,0},c[3]={0,0,0},sumaa=0,sumab=0,z=0; 
-   
-   int h=0; 
-   
-   system("cls"); 
-   
-   cout<<"nnDE QUE DIMENSIONES QUIERE EL CUADRADO MAGICO?"<<endl<<endl; 
-   
-     cout<<"1.  PARA 3x3"<<endl<<endl; 
-   
-       cin>>z; 
-   
-        if(z<=0||z>=2)cout<<" nnERROR, EL CUADRADO NO ES EL INDICADO"<<endl<<endl; 
-   
-          if(z==1)f=3; 
-   
-   do{ 
-   
-        sumaa=0,sumab=0; 
-   
-          calculos(a); 
-   
-            for(int k=0;k<f;k++) 
-            { 
-              sumaa=sumaa+a[k]; 
-            } 
-   
-          calculos(b); 
-   
-            for(int m=0;m<f;m++) 
-            { 
-              sumab=sumab+b[m]; 
-            } 
-   
-   
-            if(sumaa==sumab)h=1; 
-   
-   
-     }while(h!=1); 
-   
-           impresion(a); 
-   
-            cout<<"= "<<sumaa; 
-   
-             impresion(b); 
-   
-              cout<<"= "<<sumab; 
-   
-               for(int x=0;x<f;x++) 
-               { 
-                c[x]=sumaa-a[x]-b[x]; 
-               } 
-   
-           impresion(c); 
-   
-            cout<<"= "<<sumaa; 
-   
-              cout<<"nn========================"; 
-   
-               cout<<"nn"; 
-   
-                cout<<sumaa<<"      "<<sumaa<<"      "<<sumaa<<endl; 
-   
-  getchar(); 
-  getchar(); 
-   
-  return 0; 
- } 
-   
Gracias