Zelaron Gaming Forum

Zelaron Gaming Forum (http://zelaron.com/forum/index.php)
-   Tech Help (http://zelaron.com/forum/forumdisplay.php?f=329)
-   -   C++ help (http://zelaron.com/forum/showthread.php?t=40913)

osmoses-jones 2006-10-28 04:10 PM

C++ help
 
I have to write a c++ programe that calculate how much paint cans you need to paint a rooms. each rooms have about 12 feet x 10 feet with 8 foot ceilings. each room contains 4foot x 5 foot window and a 3 foot x 7 door. in programe i have to ask the user how much door and windows in room. Can anyone help me

Lenny 2006-10-28 04:12 PM

How big an area can each paint can paint? And is it just the walls you paint?

Demosthenes 2006-10-28 06:41 PM

Seems rather straightforward. What exactly do you seem to be having problems with? And like Lenny said, how much area can the cans paint?

osmoses-jones 2006-10-30 05:09 PM

here lab teacher gave us i don't know how to start it up.

http://img.photobucket.com/albums/v4...0/afasgasg.jpg

Lenny 2006-10-31 09:37 AM

Sure he didn't tell you how big an area each can paints?

It could be that a can paints 175 square feet, or it could be that the second wasn't fully used as both paint 200 square feet.

I don't know C++, but if it was done in VB you'd declare your variables, right? I guess that there is a similar thing done in C++?

Medieval Bob 2006-10-31 09:50 AM

Ya your teacher needs to tell you the coverage of a paint can. By that information, a can of paint could cover 349 square feet of room.

Damn I wish I was back at this level... *sigh*

Anyhow, for your program, you'll have something like this. (This is just pseudocode; don't copy it straight, because it won't work)

int totalarea
int doorarea
int windowarea
int paintablearea
int numdoors
int numwindows
int numcans

totalarea = 8 * 10 * 12

cout << how many doors?
cin >> numdoors
doorarea = numdoors * 3 * 7

cout << how many windows?
cin >> numwindows
windowarea = numwindows * 4 * 5

paintablearea = totalarea - (doorarea + windowarea)

numcans = ceil(paintablearea / WHATEVER A CAN PAINTS)
cout << The number of cans you'll need is << numcans

Demosthenes 2006-11-01 01:14 PM

Also, how is the area of the room 472 if its about 12 x 10 feet in size?

Lenny 2006-11-01 02:41 PM

12 down one side, 10 down the other, 8 high.

2(12 x 8) + 2(10x8) = 352 ---> walls

12x10 = 120 -----> Ceiling

352 + 120 = 472 ----> total paintable area as the floor cannot be painted.

Medieval Bob 2006-11-01 03:04 PM

Well hell don't give him all the answers. [/hypocrite]

I was hoping he'd convert my pseudocode, get a ridiculously high number, and then sit down to figure out why it's wrong and how to make it work.

Demosthenes 2006-11-01 03:06 PM

Well, it says Room is 472 square feet in size. Generally square footage of a room is the area of the floor in the room, which can not possibly be 472 square feet.

Lenny 2006-11-01 03:19 PM

Sorry, Bob.

---

I know what you mean, MJ. It should really be paintable Surface Area. But who are we to correct a teacher's failings?

osmoses-jones 2006-11-01 07:26 PM

ty bob i figure out how now. to find the number of cans i have to divide paintarea by 250. I got my teacher lab yay thank you god i better learn c++ fast or i will be confuse next quarter when i get to work with torque engine.

Lenny 2006-11-02 03:23 PM

What are the major differences between C++ and VB?

If you know how to do everything in VB, and know what the same functions would be in C++, then would you be able to write C++ programs using a VB one as a base?

Demosthenes 2006-11-02 04:17 PM

Quote:

Originally Posted by Lenny
What are the major differences between C++ and VB?

If you know how to do everything in VB, and know what the same functions would be in C++, then would you be able to write C++ programs using a VB one as a base?

You could use the same functions in a C++ program as you could in a VB program via DLL's, I believe. Syntactically, they're a bit different, so simply knowing VB would not allow you to code in C++, but I don't think it would be too difficult to pick up on it. I believe you can write functions in C++, put them in DLLs and then use those functions on a VB program. As for simply continuing a VB program in C++, I wouldn't be surprised if it is possible, although I have no earthly idea how to do it. I don't know VB, though, so don't quote me on any of this. I've only dabbled around with it.

Medieval Bob 2006-11-02 06:56 PM

VB is missing a good bit of the functionality of C++ is because of its simplicity. You can do anything that you can do in VB in C++ and vice versa, but typically complex programs aren't written in VB. VB isn't very well adapted to object oriented programming. And finally, C++ is much faster.

Lenny 2006-11-03 10:31 AM

I see.

So how easy is C++ to learn:

a) With no prior experience with any programming language?
b) With experience with things like VB?

Demosthenes 2006-11-03 01:18 PM

Quote:

Originally Posted by Medieval Bob
You can do anything that you can do in VB in C++ and vice versa,

Can you do system level programming and such with VB?

a.) Lenny, C was the first language I picked up on, which is not so dissimilar from C++. It was not difficult at all.

b.) It would help considerably.

Lenny 2006-11-03 01:40 PM

Rightyho.

Methinks that once I know my way around VB like the back of my hand, I'll have a crack at C++.

Medieval Bob 2006-11-03 11:43 PM

If you can write it in C++, you can write it in VB. Your implementation may have to be different, but you can get all the same functionality.

Demosthenes 2006-11-03 11:46 PM

Quote:

Originally Posted by Medieval Bob
If you can write it in C++, you can write it in VB. Your implementation may have to be different, but you can get all the same functionality.

I thought that pointers and such are restricted in VB. For instance, if I wanted to write directly to the video buffer, how would I accomplish this in VB? I don't know though, I don't know VB at all, I just heard that pointers were severely limited in VB.


All times are GMT -6. The time now is 10:30 AM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
This site is best seen with your eyes open.