C++ Programming Blog

 
 
 

Image

 # include <iostream.h>
 # include <fstream.h>
 # include <string.h>
 # include <stdlib.h>
 # include <conio.h>

 int main( )
    {
       clrscr( );

       fstream File(\"CP-18.txt\",ios::in|ios::nocreate);

       if(!File)
      {
         cout<<\"\\n Unable to open the input file.\"<<endl;
         cout<<\"\\n Press any key to exit.\";

         getch( );
         exit(EXIT_FAILURE);
      }

       char Data[100]={NULL};

       int amplitude=0;
       int frequency=0;

       File.getline(Data,80);

       amplitude=atoi(Data);

       strset(Data,NULL);

       File.getline(Data,80);

       frequency=atoi(Data);

       File.close( );

       for(int i=1;i<=frequency;i++)
      {
         for(int j=1;j<=amplitude;j++)
        {
           for(int k=1;k<=j;k++)
              cout<<j;

           cout<<endl;
        }

         for(int l=(amplitude-1);l>=1;l--)
        {
           for(int m=1;m<=l;m++)
              cout<<l;

           cout<<endl;
        }

         if(i!=frequency)
        cout<<endl;
      }

       getch( );
       return 0;
    }

    Related Post:
  1. Program to show an example of Hashing

  2. Program to show the projection of 3D objects using Standard Perspective Projection w.r.t. an Arbitrary Plane and Center of Projection...

  3. Program to evaluate series

  4. Program to perform array operations like append, insert, delete, edit, display and search and element

  5. Program to illustrate the use of the break statement

  6. Program that reads marks obtained by a student in a test of 100 marks and computes his grade

  7. Program of DDA line drawing algorithm

  8. Program to fill a Circle using Scan-Line Circle Fill Algorithm using Polar Coordinates

  9. Program that reads marks obtained by a student in a test of 100 marks and print pass if marks are greater than or equal to 50

  10. Program that takes short date from a user and displays medium date

  11. CREATING A LIST OF THE BOOKS AND THEIR DETAILS AND ACCEPTING DETAILS FROM THE CUSTOMER AND SEARCHING THE BOOKS

  12. Program to illustrate the implementation of Arithmetic Expression Evaluater accepting {} & [] also

  13. Program to draw a line using Cartesian Slope-Intercept Equation

  14. Program that computes and display the square of first ten integers. (using for loop)

  15. Program to find the value of sin at any given angle

  16. CREATING A CLASS ACCOUNTS FROM WHICH ARE DERIVED TWO CLASSES CURRENT AND SAVINGS AND THEN ASK THE USER FOR THE TYPE OF ACCOUNT HE WANTS TO CREATE

  17. Program to draw a circle using Bresenhams Circle Algorithm

  18. Program to illustrate the implementation of Y-Direction Shear Transformation

  19. Program to draw a spiral rotating clockwise at the center of the screen

  20. Program that changes an infix expression to a postfix expression according