How can I modify the program below with this prompt asking "How many minutes from now do you expect to be home?", and output a sentence saying "You will get home at HH:MM". ??
It's very URGENT!! Thank you

Solution:
#include <iostream>
#include <ctime>
using namespace std;
int main(){
time_t t;
struct tm *now;
t=time(0); //get current time
now=localtime(&t); //adjust for local time zone
int hour= now->tm_hour; //retrieve current hour
int min = now->tm_min; // retrieve current min
int c_min; // To read the number of minutes from user
cout << "How many minutes from now do you expect to be home?"
<< endl;
cin >> c_min;
// If number of minutes user entered and current number of
minutes from current time sum <= 59
if ( c_min + min <= 59){
cout << " You will get home at " << hour << ":"
<< c_min+min << endl;
}
else if ( c_min + min > 59)
{
int e_min=0;
int e_hr=0;
e_min= (c_min+min)%60;
e_hr = (c_min_min)/60;
cout << " You will get home at " << hour+e_hr <<
":" << e_min << endl;
}
/*if ( hour < 12 ) {
cout << " Good Morning Xiayoe";
}
else if ( hour > 12 && hour < 14){
cour << " Good afternoon Xiayoe";
}
else{
cout << " Good evening Xiayoe";
}*/
return 0;
}
Note: I have commented output statements of good morning, good afternoon and good evening as they are not needed.
How can I modify the program below with this prompt asking "How many minutes from now...
I have a program that needs comments added to it: #include <iostream> #include <stdio.h> #include <conio.h> #include <windows.h> using namespace std; int main() { int m, s,h; cout << "A COUNTDOWN TIMER " << endl; cout << "enter time in hours here" << endl; cin >> h; cout << "enter time in minutes here " << endl; cin >> m; cout << "enter time in seconds here" << endl; cin >> s; cout << "Press any key to start" <<...
How would I loop this so that I can test out the times 1730 and 0900 and the reverse, 0900 and 1730? Preferably a "do, while" loop if possible? #include <iostream> #include <string> using namespace std; int main() { string name; cout << "Please enter your last name " << endl; cin >> name; cout << "Welcome, " << name << endl; //Variables that are being declared int time1; int...
This is a c++ program. Use the description from Parking Ticket Simulator (listed below) as a basis, where you need to create a Car class and Police Officer class, to create a new simulation. Write a simulation program (refer to the Bank Teller example listed below) that simulates cars entering a parking lot, paying for parking, and leaving the parking lot. The officer will randomly appear to survey the cars in the lot to ensure that no cars are parked...
I created a struct for Car and now I need to turn it into a class for Car. Below is the code that I wrote for the structure. For the class, we are suppose to make the data in the class Car private, revise the input so the input function will only read the data from the user, and then it will call an additional function named setUpCar which will put the data into the object. Not sure how to...
C++. here is the problem that kind of the same with the
example that i did in class (attach picture). however, this require
use the loop to do, I get confuse. pls help me! thank you!
Problem: Define a class to implement the time of day in a program. To represent time, use three member variables: one to represent the hours, one to represent the minutes, and one to represent the seconds. Also define the following member functions in the...
How can I modify my program to return the option with the highest amount ? //A new author is in the process of negotiating a contract for a new romance novel. //The publisher is offering three options. //1. The author is paid $5,000 upon delivery of the final manuscript and $20,000 when the novel is published. //2. In the second option, the author is paid 12.5% of the net price of the novel for each copy of the novel sold....
Hey, so i am trying to have my program read a text file using a structure but i also want to be able to modify the results(I kinda have this part but it could be better). I cant seem to get it to read the file(all the values come up as 0 and i'm not sure why because in my other program where it wrote to the txt file the values are on the txt file) i copied and pasted...
C++ Programming Step 1. Design a new ADT that implements a class named Date, add 3 private member variables month, day, year along with their appropriate public constructor / getter / setter member functions inside Date.h and Date.cpp. Step 2. Design another ADT that implements a class named Watch, add 3 private member variables hour, minute, second, along with their appropriate public constructor / getter / setter member functions inside Watch.h and Watch.cpp. Step 3. Next, implement the additional SmartWatch...
Program is in C++, program is called airplane reservation. It is suppose to display a screen of seating chart in the format 1 A B C D E F through 10. I had a hard time giving the seats a letter value. It displays a correct screen but when I reserve a new seat the string seats[][] doesn't update to having a X for that seat. Also there is a file for the struct called systemUser.txt it has 4 users...
I'm just a beginner in programming,how to make this program more simple without using #include<iostream> and #include<redex> here is the question Terms to know: If-else statement,for..while..do while,loops,pointer,address,continue,return,break. Create a C++ program which contain a function to ask user to enter user ID and password. The passwordmust contain at least 6 alphanumeric characters, 1 of the symbols !.@,#,$,%,^,&,* and 1 capital letter.The maximum allowable password is 20. Save the information. Test the program by entering the User ID and password. The...