Thread: problem with an equation...

  1. #1
    Unregistered
    Guest

    problem with an equation...

    ok so i am doing this course on c++ and have been doing fairly well up to date... im only on the second chapter...

    so here is where i need help...

    Code:
    #include <iostream.h>
    
    int main()
    
    {
    	int speed;
    	cout<<"Enter the average speed: ";
    	cin>>speed;
    	cout.setf(ios::fixed);
    	cout.precision(1);
    	cout<<"The trip to school will take "<<(insert the equation here)<<" minutes."<<endl;
    	return (0);
    }
    here is the questions...

    The distance to school is 32km. Write a program that asks 6the user for an average speed in kilometers per hour, and then display the time in minutes required for the trip at this speed. The program output should look like this.

    Enter the average speed: 88
    The trip to school will take 21.8 minutes.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    This is elementary physics

    Start with
    distance = velocity * time

    Rearrange the formula to suit the problem

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  4. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  5. Quad equation using fuctions problem
    By godfrey270487 in forum C++ Programming
    Replies: 5
    Last Post: 12-07-2006, 11:23 AM