Jump to content

Welcome to Geeks to Go - Register now for FREE

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
Photo

need help in c++


  • Please log in to reply

#1
ghizlane

ghizlane

    New Member

  • Member
  • Pip
  • 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

Advertisements


#2
juber0

juber0

    Member

  • Member
  • PipPip
  • 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 :tazz:

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

  • 0

#3
ghizlane

ghizlane

    New Member

  • Topic Starter
  • Member
  • Pip
  • 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

Thank you in advance

Ghizlane
  • 0

#4
Hai Mac

Hai Mac

    Member

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

#5
ghizlane

ghizlane

    New Member

  • Topic Starter
  • Member
  • Pip
  • 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

bdlt

    Member

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

try attaching a zip file
  • 0

#7
ghizlane

ghizlane

    New Member

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

ghizlane
  • 0

#8
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 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

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP