Question: C++ Programming; Create a program that draws a diamond shape onto the console window like so: Must be done as picture shows. The program takes
C++ Programming;
Create a program that draws a diamond shape onto the console window like so:
Must be done as picture shows.
The program takes as input a number from 1 to 75 and draws the corresponding diamond to the screen.
My code is below:
// DrawDiamond.cpp : Use this shell of a program to get started
//
#include "stdafx.h"
#include
#include
using namespace std;
const int MIN_WIDTH = 1;
const int MAX_WIDTH = 75;
int main()
{
int iInputValue = 0;
while (true)
{
cout
MIN_WIDTH
cin >> iInputValue;
cout
// Is the input less than or greater than or even?
if (iInputValue MAX_WIDTH ||
(iInputValue % 2) == 0)
{
cout
system("pause");
return 0;
}
//////////////////////////////////////
/// Work here......
//////////////////////////////////////
cout
system("pause");
system("cls");
}
return 0;
}
CAUsersUohn Documents Visual Studio 2017ProjectslUTCS Please enter an 000 integer in the range of 1 to 75 or ? to quit: 5 XXxxxX Press any key to continueStep by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
