Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account

# need help in c++

### #1 ghizlane Posted 08 February 2006 - 09:06 AM

ghizlane

New Member

• Member
• 6 posts
[attachment=6450:attachment][attachment=6451:attachment]
my program has to perform these sequences:

[b]1. Prompt the user for desired altitude and a number of steps
2. Cause the balloon to ascend to 1/3 of the specified alltitude, then
cruise for one-quarter of the time steps
3. Repeat step 2 twice more(ascend 1/3, cruise 1/4, ascend 1/3, cruise 1/4)
4. Descend halfway to the ground, cruise for the remaining time steps, and then descend back to the ground
5. After the first balloon flight, the program should ask the user if he would like to continue

I wrote this, but i'm not sure if it's correct[

#include <iostream.h>
#include "balloon.h"

// illustrates use of Balloon class
// balloon (guided by auto-pilot) ascends, cruises, descends

main()
{
Balloon Gina;
Balloon Tina;
int rise; // how high to fly (meters)
int duration; // how long to cruise (seconds)

cout << "How high (in meters) to rise: ";
cin >> rise;

cout << "How long (in seconds) to cruise: ";
cin >> duration;

Gina.Ascend(rise); // ascend to specified height
Gina.Cruise(duration); // cruise for specified time-steps
Gina.Descend(0); // come to earth

cout << "How high (in meters) to rise: ";
cin >> rise;

cout << "How long (in seconds) to cruise: ";
cin >> duration;

Tina.Ascend(rise*1/3);
Gina.Ascend(rise*2);
Tina.Cruise(duration*1/4);
Gina.Cruise(duration *2);
Tina.Descend(0);
Gina.Descend(0);

}
• 0

### #2 juber0 Posted 08 February 2006 - 09:10 AM

juber0

Member

• Member
• 56 posts
Ok, after looking on the net, I am unable to find any help. Please wait until someone comes and helps, while I look on the internet

Edited by juber0, 08 February 2006 - 09:29 AM.

• 0

### #3 ghizlane Posted 08 February 2006 - 09:23 AM

ghizlane

New Member

• Topic Starter
• Member
• 6 posts
Thanks for your quick reply, i still have more files to run with the program

balloon.h
randgen.h
randgen.cpp
balloon.cpp

But i couldn't attach them to my topic

where can i send them to you

Ghizlane
• 0

### #4 Hai Mac Posted 08 February 2006 - 11:10 AM

Hai Mac

Member

• Member
• 260 posts
Well, then compile it in some free C compiler (e.g. Bloodshed Dev-cpp) and see if it works . Looks ok so far to me.
• 0

### #5 ghizlane Posted 08 February 2006 - 11:18 AM

ghizlane

New Member

• Topic Starter
• Member
• 6 posts
Thanks juber0 for your search, please if you find anything post it here so i can modify my program

Thanks to you too Hai Mac for your reply, but i need to be definite that my answer is correct, but i'm 70%

not sure

Ghizlane
• 0

### #6 bdlt Posted 09 February 2006 - 10:24 AM

bdlt

Member

• Member
• 876 posts
"But i couldn't attach them to my topic"

try attaching a zip file
• 0

### #7 ghizlane Posted 09 February 2006 - 01:09 PM

ghizlane

New Member

• Topic Starter
• Member
• 6 posts
thank you for you help
i did it

ghizlane
• 0

### #8 bdlt Posted 09 February 2006 - 03:01 PM

bdlt

Member

• Member
• 876 posts
thank you for letting us know
• 0

### Similar Topics

#### 0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users