HW HELP!

For example. The starting miles could be 100130.5 and the ending miles could be 101045.9. Also
the hours could be 16.25 (16 hours and .25 hours (15 minutes)). The miles per hour in this case
would be 56.3.
1)What impact does this have on your selection of the data type you should use for
your application?
2)Look at the above description. How many prompts for input values should your program have?
3)How many variables do you need to read in from the console? What type of data will they hold?
4)How many variables do you need for calculations and results? Again what type of data will they
is question 2 3 input values and question 3 4 variables?
thanks


Last edited on
What are you asking?
questions 1-4
hi

you can use structure for saving time.

for example
1
2
3
4
5
struct time{
int sec;
int min;
int hour;
};


use two float variable for starting point and ending point .
and one float variable to save result of calculation for output.

you must read time , starting and ending points --> which meansthree inputs.

and program must show one output as the result of calculation.

at last it will be like this or better than it !!!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Example program
#include <iostream>
#include <string>

struct Time{
    
    int hour;
    int min;
    
    
};
using namespace std;
int main()
{
  Time t;
  float starting_point;
  float ending_point;
  float result;
  cout<<"Enter time (  hour min  ) : ";
  cin>>t.hour>>t.min;
  
  cout<<"Enter Starting point : ";
  cin>>starting_point;
  cout<<"Enter Ending point   : ";
  cin>>ending_point;
  
  // result = your calculations.
  
  cout<<result;
  return 0;
  
}




is it useful ???
Last edited on
Topic archived. No new replies allowed.