Advertisement
Guest User

Untitled

a guest
Feb 28th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <array>
  3. #include <cstdlib>
  4. #include <ctime>
  5.  
  6. using namespace std;
  7. int main(void)
  8. {
  9.   array<array<int,20>,10>image;
  10.   srand(time(NULL));
  11.   float a=0;
  12.  
  13.   for(int x=0;x<10;x++){
  14.     for(int y=0;y<20;y++){
  15.       image[x][y]=rand()%256;
  16.       image[x][y]+=30;
  17.       if(image[x][y]>255)
  18.     {
  19.       image[x][y]=255;
  20.     }
  21.       if(image[x][y]>=120){
  22.     cout<<"X";
  23.       }
  24.       else{
  25.     cout<<".";
  26.     a++;
  27.       }
  28.     }
  29.     cout<<endl;
  30.   }
  31.   a=(a/200.0)*100.0;
  32.   cout<<a<<"%"<<endl;
  33.  
  34.  
  35.  
  36.  
  37.   return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement