Advertisement
apl-mhd

oopOutSidefunction

May 13th, 2017
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <cstdio>
  4.  
  5. using namespace std;
  6.  
  7.  
  8. class diy{
  9.    
  10.    
  11.    
  12.     public:
  13.         string name;
  14.         int id;
  15.        
  16.     void loop(int n);
  17. };
  18.  
  19.  
  20. void diy::loop(int n){
  21.        
  22.         for(int i=0; i<n; i++)
  23.             cout<<n<<" ";
  24.     cout<<"\n";
  25. }
  26.    
  27.  
  28.  
  29. int main(int argc, char **argv)
  30. {
  31.    
  32.     diy one;
  33.     int n=18;
  34.     while(n--)
  35.         one.loop(n);
  36.    
  37.    
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement