Question

Code in C++ please

9.13 Review: Branches: Next date Many websites let users make reservations (hotel, car, flights, etc.). When a user selects a1: Compare output 0/1 Output differs. See highlights below. Input 1 1 2017 Your output 2017 Expected output 1 2 2017 2: Compa5: Compare output a 0/1 Output differs. See highlights below. Special character legend Input 1 31 2000 Your output Invalid Da9: Compare output a 0/1 Output differs. See highlights below. Input 5 31 2017 Your output 6 31 2017 Expected output 6 1 201713: Compare output A 0/1 Output differs. See highlights below. Special character legend Input 9 30 2017 Your output Invalid D

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Thanks for the question. Below is the code you will be needing. Let me know if you have any doubts or if you need anything to change.

Let me know for any help with any other questions.

Thank You!
===========================================================================

#include<iostream>
using namespace std;

int main(){
  
   int day, month, year;
  
   cin >> month >> day >> year;
  
   if(month==1 || month==3 || month==5 || month==7 || month ==8 || month ==10 ){
      
       if(day<31) day++;
       else {
           day = 1;
           month+=1;
       }
   }
   else if(month ==2){
       if(day<28) day++;
       else {
           day = 1;
           month+=1;
       }
   }
   else if(month==4 || month ==6 || month==9 || month ==11){
       if(day<30) day++;
       else {
           day = 1;
           month+=1;
       }
   }
   else {
       if(day<31) day++;
       else {
           day = 1;
           month=1;
           year +=1;
       }
   }
  
   cout<<month <<" "<<day <<" " << year;
  


   return 0;
}
===============================================================

Add a comment
Know the answer?
Add Answer to:
Code in C++ please 9.13 Review: Branches: Next date Many websites let users make reservations (hotel,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • How do I add the space that this Zybooks code keeps asking me to add? 5.13...

    How do I add the space that this Zybooks code keeps asking me to add? 5.13 LAB: Output numbers in reverse Write a program that reads a list of integers, and outputs those integers in reverse. The input begins with an integer indicating the number of integers that follow. For coding simplicity, follow each output integer by a space, including the last one. Assume that the list will always contain fewer than 20 integers. Ex: If the input is: 5...

  • can someone please tell me where did I do wrong and how I can fix this...

    can someone please tell me where did I do wrong and how I can fix this TU. . IVIL main.py Load default template... 1 # Read a list of strings from the user' 3 def square(x): return x*x nmin on input_string = input() 7 numbers= 11 8 for i in (str(input_string): numbers.append(i*2) 10 # Use list comprehension to cast them to ints 11 numbers = [int(i) for i in input_string.split()] 12 result = list (map(lambda x: x*x, numbers)) 13 for...

  • in python and can you tell me why i am wrong? Thank you ZyBooks Python M...

    in python and can you tell me why i am wrong? Thank you ZyBooks Python M X zy cS 171: Computer x zy 11.9. LAB: Output x C Write A Program 1 x Slack | Hiu Nguy TG Python Program t x p ython - Getting x +. - 5 x € → e l earn.zybooks.com/zybook/DREXELCS171 Winter2020/chapter/11/section/9 Help/FAQ Kuanyu Lai - = zyBooks Bake My library > CS 171: Computer Programming home> > 11.9: LAB: Output values in a list...

  • JAVA Directions: Write a unit test for addInventory(), which has an error. Call redSweater.addInventory() with parameter...

    JAVA Directions: Write a unit test for addInventory(), which has an error. Call redSweater.addInventory() with parameter sweaterShipment. Print the shown error if the subsequent quantity is incorrect. Sample output for failed unit test given initial quantity is 10 and sweaterShipment is 50: Beginning tests. UNIT TEST FAILED: addInventory() Tests complete. Note: UNIT TEST FAILED is preceded by 3 spaces. What I have so far: // ===== Code from file InventoryTag.java ===== public class InventoryTag { private int quantityRemaining; public InventoryTag()...

  • hey please answer in python 3 This is the test for these questions. it has to...

    hey please answer in python 3 This is the test for these questions. it has to be exactly the same as the Expected output. notice my code is very close to getting it but im always off by 0.01 or 0.02. Thank you for the help! In this exercise, you will build a program to process files containing paragraphs. The aim of the program is to simply count the number of words and compute their length. The file, however, may...

  • Not sure how to get rid of the spaces at the end. Thanks for any help...

    Not sure how to get rid of the spaces at the end. Thanks for any help learn.zybooks.com 21.7. Nested loops zyBooks My library EGR 219 home 21.7: Nested loops E zyBooks catalog Help/FAQ Dennis Roberts CAHALE.7.1: Nested loops: Indent text Print numbers 0, 1,2,. serNum as shown, with each number indented by that number of spaces. For each printed line, print the leading spaces, then the number, and then a newline. Hint: Use i and j as loop variables (initialize...

  • in c++ please Write a program in c+ to do the following: 1.Save the data shown...

    in c++ please Write a program in c+ to do the following: 1.Save the data shown below (in the same format) to make a text file called "InputData. txt"; use the file as input to enter data into a hash table. Fname Lname 2019-01-31 First Last 2018-02-01 Jonh Doe 2017-03-28 Jane Doe 2016-04-01 as the data items in the file 2. Your hash table should have as many entries 3. The birthday should be used as the hash key by...

  • help me all please Check my work On January 1, 2017, SONOB Company issues 16%, $5,000,000 4-year bonds and the bond...

    help me all please Check my work On January 1, 2017, SONOB Company issues 16%, $5,000,000 4-year bonds and the bonds pay interest quarterly on Mar 31, Jun 30, Sep 30, and Dec 31 each year. The prevailing market interest rate at the date of issue is 12%. Use the Effective Interest Rate method of amortization. REQUIRED: 1. Calculate the price of the bonds at the issue date Principal Coupon Payment Future Value $ 5,000,000.00 Present Value Factor Present Value...

  • Please help modify my C program to be able to answer these questions, it seems the...

    Please help modify my C program to be able to answer these questions, it seems the spacing and some functions arn't working as planeed. Please do NOT copy and paste other work as the answer, I need my source code to be modified. Source code: #include <stdio.h> #include <string.h> #include <ctype.h> #include <stdlib.h> int main(void) { char title[50]; char col1[50]; char col2[50]; int point[50]; char names[50][50]; printf("Enter a title for the data:\n"); fgets (title, 50, stdin); printf("You entered: %s\n", title);...

  • C Programming Quesition (Structs in C): Write a C program that prompts the user for a...

    C Programming Quesition (Structs in C): Write a C program that prompts the user for a date (mm/dd/yyyy). The program should then take that date and use the formula on page 190 (see problem 2 in the textbook) to convert the date entered into a very large number representing a particular date. Here is the formula from Problem 2 in the textbook: A formula can be used to calculate the number of days between two dates. This is affected by...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT