jay-r wrote:
> In the book Accelerated C++, there 2 exercises that I can't figure out 
> how to write the codes.
>
> 1. Write a set of "*" characters so that they form a square, a 
> rectangle, and a triangle.....I did the square and rectangle but I have 
> a problem with the triangle.
>   

You need a loop similar to what you used for the first two shapes, but 
you need to print the splats in different locations for the triangle. 
The exercise does not say what type of triangle, so I would use one that 
is the easiest -- a 90/45/45 right triangle. You need two straight lines 
(like a square) and a diagonal between the ends of the two lines. The 
main difference between this and a square is the length of a given line. 
While a square has a constant width, the triangle's line width will 
change over the loop.

> 2. Write a program to generate the product of the numbers in the range 
> [1, 10).
>   

This is a fairly simple loop with an accumulator -- what is your code so 
far?

> Another problem is I can't run this...#include <iomanip>...from a Dev-
> C++ compiler. Any suggestion?
>   

I am not sure, that is a standard header according to section 27 (table 
82) of the 2003 C++ standard. Are you including it in the same place as 
your other headers, such as <string> or <iostream>?

-- 
John Gaughan

Reply via email to