c ++ Shan oval cell Videos

 

#ifndef _TEST_H
#define _TEST_H
#include <iostream>
#include <math.h>
using namespace std;

int main ()
{
    const  Double PI = 3.14159 , P = 16.0 ; // pi and the radius of the circle 
    Double angle;                     // angle 
    int X, Y;                         // compute memory array coordinates 
    char Rose [ 25 ] [ 80 ];                 // simulation screen 25 * 80 pixels 
    for (X = 0 ; X < 80 ; X ++)                 // blanking 
    {
         for (Y = 0 ; Y < 25 ; Y ++ )
        {
            rose[y][x]=' ';
        }
    }
    for ( int I = 0 ; I < 20 is ; I ++)             // the pattern through the track position is set to * 
    {
         // Note that x coordinate value is the actual number of columns, y coordinate value is the actual number of rows 
        angle = i * pi / 10 ;
        X = int (P * COS (angle)) * 2 + 40 ;     // multiplied by two and divided by two in order to adjust only display 
        Y = int (* P SiN (angle)) / 2 + 13 is ;    // Since the control display character table when unequal ratios of the width and height 
        Rose [Y] [X] = ' * ' ;                 // to 40 and 13 to the center of the screen is an analog pixel decision, of course, may be additionally provided 
    }
     for (Y = 0 ; Y < 25 ; the y-++ )
    {
        for (x=0;x<80;x++)
        {
            cout<<rose[y][x];
        }
        cout << endl;
    }
    /*const double pi=3.14159,a=16.0;
     const int aspect = 2;
     double angle,p=16;
     int x,y;
     char rose[25][80];
     for (x=0;x<80;x++)
     {
     for (y=0;y<25;y++)
     {
     rose[y][x]=' ';
     }
     }
     for (int i=0;i<128;i++)
     {
     angle = i * pi / 64;
     p=a*sin(2*angle);
     x=int(p*cos(angle))*aspect+40;
     //x=int(p*cos(angle))+40;
     y = int (p * sin (angle)) + 13;
     rose[y][x]='*';
     }
     
     for (y=0;y<25;y++)
     {
     for (x=0;x<80;x++)
     {
     cout<<rose[y][x];
     }
     cout << endl;
     }*/
    return 0;
}
#endif //_TEST_H

Export

                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                *       *       *                               
                      *                                   *                     
                                                                                
                *                                               *               
                                                                                
          *                                                           *         
                                                                                
          *                                                             *       
                                                                                
          *                                                           *         
                                                                                
                *                                               *               
                                                                                
                      *                                   *                     
                                *       *       *                               
                                                                                
                                                                                
                                                                                
                                                                                
Program ended with exit code: 0

 

 

 

 

Guess you like

Origin www.cnblogs.com/sea-stream/p/11100319.html