#include <iostream>
using namespace std;
int main() {
// Collect current time and time of day
int hr, min;
char answer;
// string time_of_day;
cout << "What hour of the day is it?" << endl;
cin >> hr;
cout << "What minute of the day is it?" << endl;
cin >> min;
// Collect input for when, from current time, the user wants the alarm to ring
int wait_hr, wait_min, wait_sec, wait_day;
cout << "In how many days do you want your alarm to ring?" << endl;
cin >> wait_day;
cout << "In how many hours (after simplifying to days) do you want your alarm to ring?" << endl;
cin >> wait_hr;
cout << "In how many minutes (after simplifying to hours) do you want your alarm to ring?" << endl;
cin >> wait_min;
cout << "In how many seconds (after simplifying to minutes) do you want your alarm to ring?" << endl;
cin >> wait_sec;
int f_hr, f_min, f_sec;
// Calculating the final seconds value in the time
f_sec = wait_sec;
while (f_sec >= 60) { // If the final num of seconds is greater than or equal to 60 minutes,
wait_min = wait_min + (f_sec / 60); // add remainder to variable storing number of hours to be added
f_sec = abs(f_sec - 60); // subtract 60 & take the absolute value
}
// Calculating the final minute value in the time
f_min = min + wait_min;
while (f_min >= 60) { // If the final num of minutes is greater than or equal to 60 minutes,
wait_hr = wait_hr + (f_min / 60); // add remainder to variable storing number of hours to be added
f_min = abs(f_min - 60); // subtract 60 & take the absolute value
}
// Calculating the final hour value in the time
f_hr = (hr + wait_hr) % 24;
while (f_hr > 12) {
f_hr = ((hr + wait_hr) % 12);
}
if (f_hr == 0) {
f_hr = 12;
}
// Calculate how many days from now the alarm will ring
int f_days;
f_days = ((hr + wait_hr) / 24) + wait_day;
//
cout << "In " << f_days << " day(s), at " << f_hr << ":" << f_min << " : " << f_sec << ", your alarm will ring.";
}
Benefits of TheCodeground Online IDE
Multi-Language Support
TheCodeground Online IDE supports C++, Java, Node.js, Python, and more, making it an incredibly versatile tool for diverse coding needs. This extensive language support allows developers to work on different projects within a single platform.
Real-Time Collaboration
Our real-time collaboration feature enables multiple developers to work on the same project simultaneously, enhancing teamwork and productivity. This feature is particularly beneficial for remote teams and pair programming sessions.
User-Friendly Interface
Designed with a clean and intuitive interface, TheCodeground Online IDE simplifies coding and debugging processes, making it accessible for users of all skill levels. The ease of use and clear navigation ensure a smooth coding experience.
Instant Code Execution
Experience fast and efficient code execution with immediate feedback in the integrated terminal. This feature helps streamline the development process, allowing developers to quickly test and debug their code.
Free to Use
Enjoy the full range of features at no cost. TheCodeground Online IDE is completely free, providing a valuable resource for developers without any subscription fees. This makes it an ideal choice for students, hobbyists, and professionals alike.
Cloud-Based Platform
As a cloud-based IDE, TheCodeground allows you to access your projects from anywhere, at any time. This flexibility ensures that you can continue coding without being tied to a specific device or location.
Customizable Environment
Tailor the IDE to your preferences with customizable themes, layouts, and extensions. This personalization ensures a comfortable and productive coding environment.
Why Choose TheCodeground Over Other Online IDEs?
TheCodeground Online IDE stands out from the competition with its comprehensive feature set, ease of use, and cost-effectiveness. Unlike many other online IDEs that require subscriptions or offer limited free plans, TheCodeground provides all its features for free. Our multi-language support, real-time collaboration, and advanced debugging tools ensure that you have everything you need for effective development. Additionally, our user-friendly interface and customizable environment make coding a pleasant experience, regardless of your expertise level. Choose TheCodeground Online IDE for a seamless, efficient, and enjoyable coding experience.