PDA

View Full Version : C++ Shape Program Help


mscags
10-27-2005, 07:05 PM
Alright so I have this program due tomorrow and have no idea how to start it!! Click here and go to homework 3 http://www.cs.missouristate.edu/~liu/csc125/index.htm Any help would be greatly appreciated. Thanks

Mike

cgwahl
10-27-2005, 08:33 PM
I would just use dynamic multi-dimensional arrays based on the parameters entered by the user...

mscags
10-27-2005, 08:38 PM
English please lol I'm in an intro class and know nothing about C++ Thanks

StevieG
10-27-2005, 08:50 PM
[ QUOTE ]
English please lol I'm in an intro class and know nothing about C++ Thanks

[/ QUOTE ]

This is Java, so you're going to have to port it to C++ yourself:

<font class="small">Code:</font><hr /><pre>
while (student.takingClassForCredit() ) {
try {
student.DoYourOwnWork();
} catch (slackerException se) {
if (se.Type == slackerException.gettingPissyAtPeopleWhoDoTryToHel p) {
student.FOAD();
}
}
}
</pre><hr />

OrcaDK
10-27-2005, 08:51 PM
[ QUOTE ]
I would just use dynamic multi-dimensional arrays based on the parameters entered by the user...

[/ QUOTE ]

Why make is so advanced? All of those tasks can be solved using for loops, besides the menu coding of course.

cgwahl
10-27-2005, 08:53 PM
[ QUOTE ]
English please lol I'm in an intro class and know nothing about C++ Thanks

[/ QUOTE ]


Basically arrays created on the fly. Your book should show this...otherwise just do a few searches online (your greatest resource for programming anyhow).

For instance the rectangle...say the user wants one that is 4x8

I create 2-dimensional array [4][8] (really it'd be [x][y] or is it (x)(y)?...I can't remember)

Then you'll just have to create the algorithm to give you the output to the array

$$$$$$$$
$oooooo$
$oooooo$
$$$$$$$$

The o's is whitespace.


As for the other 2, just look for the pattern...pretty easy to pick out. Once you figure the one out for the triangle, you'll then have the one for the diamond.

cgwahl
10-27-2005, 08:54 PM
[ QUOTE ]
[ QUOTE ]
I would just use dynamic multi-dimensional arrays based on the parameters entered by the user...

[/ QUOTE ]

Why make is so advanced? All of those tasks can be solved using for loops, besides the menu coding of course.

[/ QUOTE ]


True

I just like arrays. heh

mscags
10-27-2005, 11:05 PM
Thanks for the help. I think I can make it work that way.

Mike