Advertisement
miller87

язык "c" не могу написать код

Oct 24th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.24 KB | None | 0 0
  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9. #include <stdio.h>
  10. #include <iostream.h>
  11. #include <conio.h>
  12. #include <math.h>
  13. #include <stdlib.h>
  14.  
  15. void main()
  16. {
  17.     int X=2,f=2,Y=2,w=2,key,b=2,a=2;
  18.     int v[20];
  19.     float G;
  20.  
  21.     cout<<"meniu:";
  22.     cout<<"\n 1.metoda for";
  23.     cout<<"\n 2.metoda while";
  24.     cout<<"\n 3.metoda do";
  25.     cout<<"\n 4.iesire";
  26.     cout<<"\n alege metoda:";
  27.     cin >> key;
  28.     if((Y-(X-w)==14))
  29.     {
  30.         switch ( key )
  31.         {
  32.         case 1:
  33.             {
  34.                 for(f=(X-w);f<Y;f++)
  35.                 {
  36.                     G=(pow(b,2)+a-f)/sqrt(abs(a+b));
  37.                     cout<<"ati ales metoda for\tG="<<G;
  38.                 }
  39.                 break;
  40.             }
  41.         case 2:
  42.             {
  43.                 f=(X-w);
  44.  
  45.                 {
  46.                     G=(pow(b,2)+a-f)/sqrt(abs(a+b));
  47.                     cout<<"ati ales metoda while\tG="<<G;
  48.                     f++;
  49.                 }
  50.                 break;
  51.             }
  52.         case 3:
  53.             {
  54.                 f=(X-w);
  55.                 do
  56.                 {
  57.                     G=(pow(b,2)+a-f)/sqrt(abs(a+b));
  58.                     cout<<"G="<<G;
  59.                     f++;
  60.                 } while(f<Y);
  61.                 break;
  62.             }
  63.         case 4:
  64.             {
  65.             exit(0);
  66.             }
  67.         }
  68.     }
  69.     else
  70.     {
  71.         cout<<"\nintervalul nu se satisface";
  72.         cout<< "\nG=" << G;
  73.     }
  74.  
  75.     cout<<"\n\n\tPrima conditie al lucrarii practice Nr.4";
  76.  
  77.         v[20]=G;
  78.         cout<<"\n\nv "<<G;
  79.         cout<<"\n\n\tAdoua conditie al lucrarii practice Nr.4 \n\n";
  80.         int Q[20] ,i ;
  81.  
  82.         randomize();
  83.         for (i=0;i<20;i++)
  84.         {
  85.          cout<<" "<< Q[i];
  86.         }
  87.  
  88. getch();
  89.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement