Posts

Showing posts with the label square

printing Alphabets in a shape like diamond inside a square using C++

Image
Hello From IQBAL ! guys, after tiresome work i have produced the following code to print alphabets like below:   Below is the source code, feel free to comment your suggestions and corrections. #include <iostream> using namespace std; int main(void){     int a= 65;     char height = 'G'; // can get this as input via cin>>     int endchar = (int) height;     int rows, c, k;          rows =endchar-a-1; int steps = rows;     for (k=1; k<=rows+1; k++)     {      for(c=0; c<=steps; c++)     {     cout<<((char)(65+c));     }         for(c=1; c<=(2*k-2); c++)     {     cout<<" ";     }     if(k==1){         for(c=1; c<=rows; c++) {     cout<<((char)(endchar-c-1));     } ...