Question: Hi can someone help me my code. its not working correctly when I enter a number such as 1 5 its suppose to come out
Hi can someone help me my code. its not working correctly when I enter a number such as its suppose to come out through across the st row the through on the second and so on to give an hourglass shape with zeros on the empty spaces. like on the example and its coming out wrong, nowhere near it but I cannot use array, vectors or private functions. please help and look at the sample output. thank you.
my code;
#include
#include
using namespace std;
void printHourglassint size
int width size ;
int mid size;
for int i ; i size; i
for int j ; j width; j
if j mid i && j mid i
cout i;
else
cout ;
cout endl;
for int i size ; i ; i
for int j ; j width; j
if j mid i && j mid i
cout i;
else
cout ;
cout endl;
int main
char choice;
do
int size;
cout "Enter size: ;
cin size;
printHourglasssize;
cout "More yn;
cin choice;
while choice y choice Y;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
