PDA

View Full Version : C++ Help!



pinacle
02-03-02, 11:27 AM
Hi,
I am a student and I have to write a program to have a diamond come out on the output screen. It has to look like this........................*
...........................***
.........................*****
...........................***
.............................*


-Disregard all the periods before each line of the stars, I just had to put them there to get the diamond centered.

But I have to try and see how big it can be on the output screen. I know I have to use while loops and odd numbers for the amount of stars on a line. I dont know where to start and I know that it is probably simple and one of you out there can do it in like 5 minutes. Please Help!!!

el bob
02-03-02, 03:08 PM
Originally posted by pinacle
Hi,
I am a student and I have to write a program to have a diamond come out on the output screen. It has to look like this........................*
...........................***
.........................*****
...........................***
.............................*


-Disregard all the periods before each line of the stars, I just had to put them there to get the diamond centered.

But I have to try and see how big it can be on the output screen. I know I have to use while loops and odd numbers for the amount of stars on a line. I dont know where to start and I know that it is probably simple and one of you out there can do it in like 5 minutes. Please Help!!!

this was the first program i had to do last year in my first year of c++

the code was based on for loops and counters and a couple simple cout<<"*";

keep trying to do it but if you absolutely can't do it and need the code i can send it to you

evanah13
02-25-02, 06:05 PM
make sure you have your #include <iomanip.h> lib and use setw() or you could just do like cout<<" *" with the spaces and then you don't need the manipulator

Maliy
03-14-02, 04:20 PM
Originally posted by pinacle
Hi,
I am a student and I have to write a program to have a diamond come out on the output screen. It has to look like this........................*
...........................***
.........................*****
...........................***
.............................*


-Disregard all the periods before each line of the stars, I just had to put them there to get the diamond centered.

But I have to try and see how big it can be on the output screen. I know I have to use while loops and odd numbers for the amount of stars on a line. I dont know where to start and I know that it is probably simple and one of you out there can do it in like 5 minutes. Please Help!!!

I made a similar one a year ago but it was a pyramid figure.