Advertisement
Guest User

maria

a guest
Feb 24th, 2020
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.33 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. ifstream f("bac.txt");
  5. void citire(int n)
  6. {
  7.     for(i=1; i<=n; i++)
  8.         for(j=1; j<=n; j++)
  9.         {
  10.             f>>a[i][j];
  11.         }
  12. }
  13. void tiparire(int x[],int cont)
  14. {
  15.     for(i=1; i<=cont; i++)
  16.         cout<<x[i]<<" ";
  17. }
  18. int prim(int a)
  19. {
  20.     int ok=1,i;
  21.     for(i=2; i<=a/2; i++)
  22.     {
  23.         if(a%i==0)ok=0;
  24.     }
  25.     if(ok==1)return 1;
  26.     else return 0;
  27. }
  28. int superprim(int a)
  29. {
  30.     int c,ans=1,ok,nr;
  31.     c=a;
  32.     ans=1;
  33.     while(c!=0)
  34.     {
  35.         c=c/10;
  36.         ans=ans*10;
  37.     }
  38.     ans=ans/10;
  39.     ok=1;
  40.     while(ans!=0)
  41.     {
  42.         nr=a/ans;
  43.         if(prim(nr)==0)ok=0;
  44.         ans=ans/10;
  45.     }
  46.     if(ok==1)return 1;
  47.     else return 0;
  48. }
  49. void inserare(int x[], int cont, int a)
  50. {
  51.     int i,v[200],cont1=0;
  52.     for(i=1; i<=cont; i++)
  53.     {
  54.         if(x[i]<a && x[i+1]>a)
  55.         {
  56.             v[++cont1]=x[i];
  57.             v[++cont1]=a;
  58.             v[++cont]=a[i+1];
  59.         }
  60.         else v[++cont]=x[i];
  61.     }
  62.     for(i=1; i<=cont1; i++)
  63.     {
  64.         x[i]=v[i];
  65.     }
  66. }
  67. void construire(int x[], int cont)
  68. {
  69.     int cont2=0,i,v[200];
  70.     for(i=1; i<=coont; i++)
  71.     {
  72.         if(superprim(x[i])==1)v[++cont2]=x[i];
  73.     }
  74.     for(i=1; i<=cont2; i++)
  75.     {
  76.         x[i]=v[i];
  77.     }
  78. }
  79. int main()
  80. {
  81.  
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement