Program Geometry C++

A sequence U1, U2, U3, .... called geometric sequence if the sequence comparison of the two tribes are fixed. Value of the fixed ratio is called the ratio. a + ar ² + ....... + Arn-1 is called a geometric series with a composition as follows:

a = initial rate
r = ratio
n = many tribes
Formula to find the nth are as follows:

Formula to find the number of n terms is as follows:

• Algorithm Print Geometric Series
    Print geometric algorithms
    Declaration:
      a, b, n, i: Integer
      x []: Array of Integer

    Description:
       read (a, b, n)
       x [1] <= 1
       x [2] <= a * b
       x [3] <= a * b * b
           for i = 4 to n do
           x [i] <= x [2] * [xi-1]
          end for
              for i = 1 to n do
              write (x [i])
             end for

• Counting algorithm of the n
      The algorithm to calculate nth
    Declaration:
      a, b, n, un, i, r: integer

    Description:
       read (a, b, n)
       r <= 1for i = 1 to (n-1) do
       r <= r * b
         end for
         un <= a * r
         write un

• Algorithm Counting all the tribes
      Algorithms add up all the Tribes
      Declaration:
         read (n)
         number, i, n: Integer
         x [ ] : Array of Integer

     Description:
         number <= 0
            for i = 1 to n do
            sum <= sum + x [i]
            end for
        write (number)
Geometric Series Program
    # Include
    # Include

    using namespace std;
    geometry class {
        friend istream & operator>> (istream &, & geometry);
        friend ostream & operator <<(ostream &, & geometry);

    public:
         geometry ();
         void print ();

    private:
         int x [100];
         int a, b, n, un, sn;
         int count;
         };

    istream & operator>> (istream & mlebu, geometry & s) {
           court <<"Enter Interest First:"; mlebu>> S.A;
           court <<"Enter r:"; mlebu>> s.b; court <
           court <<"Enter the Number of Interest:"; mlebu>> sn; court <
           mlebu return;
           }
    
    ostream & operator <<(ostream & metu, geometry & v) {
           metu <<"Interest First:" <<
           metu <<"r:" <<
           metu <<"Number of Interest:" <<
           metu <<"Geometric Series:";
           for (int i = 0; i
             metu <<<",";}
             metu <
             metu <<"Total All Runs:" <<
             return metu;
             court <
                      
    geometry: geometry () {
                court <<"runni" <
        court <
        }
       
    void geometry:: print () {
         x [0] = a;
         x [1] = a * b;
         x [2] = a * b * b;
         for (int i = 2; i
            x [i] = x [1] * x [i-1];}
            number = 0;
               for (int i = 0; i
                sum = sum + x [i];}
                }
              
    int main (int argc, char * argv [])
    {
     geometry x;
     cin>> x;
     x.cetak ();
     court <
     court <

    system ("PAUSE");
    return EXIT_SUCCESS;
    }


0 comments:

Twitter Delicious Facebook Digg Favorites More