Question

ACTUE 142 Read multiple user inputs Write two statements to get input values into birthMonth and birthYear. Then write a statement to output the month, a slash, and the year. End with newline The program will be tested with inputs 1 2000, and then with inputs 5 1950. Ex If the input is 1 2000, the output is 1/2000 4 int main) ( 5 int birthMonth; 6 int birthYear 8 cino>birthMonth; 10 return ; Run
0 0
Add a comment Improve this question Transcribed image text
Answer #1

C++ Code:

#include<iostream>

using namespace std;

int main()

{

                int birthMonth;

                int birthYear;

               

                cin>>birthMonth; //statement to get input for birthMonth

                cin>>birthYear; //statement to get input for birthYear

               

                //statement to output birthmonth, a slash and birthYear. Ending with a new line.

                cout<<birthMonth<<"/"<<birthYear<<endl;

               

                return 0;

}

OUTPUT:

1 2000 1/200e

5 195e 5/1950

Add a comment
Know the answer?
Add Answer to:
ACTUE 142 Read multiple user inputs Write two statements to get input values into birthMonth and...
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
  • Write a do-while loop that continues to prompt a user to enter a number less than...

    Write a do-while loop that continues to prompt a user to enter a number less than 100, until the entered number is actually less than 100. End each prompt with a newline. Ex: For the user input 123, 395, 25, the expected output is: Enter a number (<100): Enter a number (<100): Enter a number (<100): Your number < 100 is: 25 c++ #include using namespace std; int main() { int userInput = 0; do cout << "Your number <...

  • C++ Program Write a do-while loop that continues to prompt a user to enter a number...

    C++ Program Write a do-while loop that continues to prompt a user to enter a number less than 100, until the entered number is actually less than 100. End each prompt with a newline. Ex: For the user input 123, 395, 25, the expected output is: Enter a number (<100): Enter a number (<100): Enter a number (<100): Your number < 100 is: 25 #include <iostream> using namespace std; int main() { int userInput; /* Your solution goes here */...

  • (Java) Rewrite the following exercise below to read inputs from a file and write the output...

    (Java) Rewrite the following exercise below to read inputs from a file and write the output of your program in a text file. Ask the user to enter the input filename. Use try-catch when reading the file. Ask the user to enter a text file name to write the output in it. You may use the try-with-resources syntax. An example to get an idea but you need to have your own design: try ( // Create input files Scanner input...

  • Create a java class that user put two inputs and first input generate n length array...

    Create a java class that user put two inputs and first input generate n length array of randomly generated numbers. and the second input changes that number of multiples in the array into zero. for example, if the user puts 3 and 5 then it generates 34 60 10 and since the second input is 5 then the multiple of 5 eliminates so it generates 34 0 0 here is the main method that I'm going to use class Main...

  • Write a do-while loop that continues to prompt a user to enter a number less than...

    Write a do-while loop that continues to prompt a user to enter a number less than 100, until the entered number is actually less than 100. End each prompt with newline Ex: For the user input 123, 395, 25, the expected output is: Enter a number (<100): Enter a number (<100): Enter a number (<100): Your number < 100 is: 25 import java.util.Scanner; public class NumberPrompt { public static void main (String [] args) { Scanner scnr = new Scanner(System.in);...

  • solve using the code provided Write a program that will continuously read words from the user,...

    solve using the code provided Write a program that will continuously read words from the user, word by word till the user enter "quit”, the program should print each word in reverse order. Sample Session: (User input in Red color) Enter a word: hello olleh Enter a word: Ahmad damhA Enter a word: quit Good Bye 9 dinclude <iostream> 10 dinclude <cstring> 11 using namespace std; 12 13 int main() { 14 15 char word(100); 16 cin>>word; 17 while (strcmp(word,...

  • use C++ please 1. Vowels and Consonants Write a program that asks the user to input...

    use C++ please 1. Vowels and Consonants Write a program that asks the user to input three different integers. Write a function called numberStyle for this program that will accept each integer (one at a time) and return the following . If the integer is even, return 1 . If the integer is odd, return -1 . If the integer is zero, return O In main, after calling the function output the appropriate message describing the integers ing the function...

  • Write a script which asks the user to input numbers until the user inputs 0. Then...

    Write a script which asks the user to input numbers until the user inputs 0. Then the script should print only the positive numbers entered by the user, in reverse order E.G. if the user inputs '4, -1, 5, 2, -3, -8, 0', the script should print '2, 5, 4'. Please don't copy someone else's answer as they don't work.

  • Write a C++ program using user defined functions that will read in the lengths of two...

    Write a C++ program using user defined functions that will read in the lengths of two side of a right triangle and then calculate the length of the hypotenuse. The program should do this twice. The program should the following user defined functions: Function readA will read in a value for side A from the user and return it to main. (it will not receive any input data from main) Function readB will read in a value for side B...

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