![]() |
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
|
How big an area can each paint can paint? And is it just the walls you paint?
|
Seems rather straightforward. What exactly do you seem to be having problems with? And like Lenny said, how much area can the cans paint?
|
here lab teacher gave us i don't know how to start it up.
http://img.photobucket.com/albums/v4...0/afasgasg.jpg |
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++? |
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 |
Also, how is the area of the room 472 if its about 12 x 10 feet in size?
|
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. |
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. |
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.
|
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? |
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.
|
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? |
Quote:
|
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.
|
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? |
Quote:
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. |
Rightyho.
Methinks that once I know my way around VB like the back of my hand, I'll have a crack at C++. |
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.
|
Quote:
|
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.