Search
 
SCRIPT & CODE EXAMPLE
 

CPP

how to draw a rectangle with diagonals and axes of symmetry in c ++ in the console?

#include <iostream>
#include <stdio.h>
#include <stdlib.h>

#include <math.h>


int main(int argc, char *argv[]) {
int s,d;
    printf ("the length of the rectangle 
");
    scanf ("%d",&s);
    printf ("width of the rectangle 
 ");
    scanf ("%d",&d);
    int l;
    int p;
    int przekatna; 

    for (p=1; p<=s; p++)
    {
    printf ("
");
    for (l=1;l<=d; l++)
    {

    if(p==1 || l==1 || l==d || s==p || p==((d+1)/2)  ) printf("*"); else printf(" ");
    if ( l==(d)/2 && p!=((d+1)/2) && p!=1 && p!=s) 
    printf("*"); else printf(""); 


    }
}
     return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: cpp class access array member by different name 
Cpp :: sfml time set 
Cpp :: bnchch 
Cpp :: file transfer socat 
Cpp :: && in cpp 
Cpp :: estimateaffine3d example c++ 
Cpp :: convert c++ to c language 
Cpp :: go to particular place in vector using iterator 
Cpp :: map::begin 
Cpp :: what type is this c++ 
Cpp :: C++ Single Line Comments 
Cpp :: Temporary file using MSFT API in cpp 
Cpp :: stack using cpp 
Cpp :: what is stdarg.h used for 
Cpp :: default argument c++ 
Cpp :: access the element of vector point2f c++ 
Cpp :: To toggle (flip the status of) the k-th item of the set 
Cpp :: c++ read_ascii 
Cpp :: program in c++ for simple interest rate 
Cpp :: return value from a thread 
Cpp :: c++ ignore_line 
Cpp :: ex:Roblox 
Cpp :: arduino jumper programmieren 
Cpp :: sort in descending order c++ 
Cpp :: how to find second smallest element using single loop 
Cpp :: CREDSCORE codechef solution 
Cpp :: e.cpp 
Cpp :: Integer Literrals in C++ Programming 
Cpp :: c++ ascii value 
Cpp :: main function 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =