Questions: 11 448

Answers by our Experts: 10 707

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Arraying 101


by CodeChum Admin



I want you to make an array of numbers for me. All you have to do is make a program that will let me input any random integer in one line. Afterwards, it will then print out all the numbers I've inputted, backwards, on separate lines.





Care to do that for me?



Input



The first line contains the size of the array.


The next line contains the integers separated by a space.



5


1·64·32·2·11


Output



Multiple lines containing integers on each.



11


2


32


64


1

Create a structure called time. Its three members, all type



int, should be called hours, minutes, and seconds. Write a



program that obtains two time values from the user in



12:59:59 format, stores them in struct time variables,



converts each one to seconds (type int), adds these



quantities, converts the result back to hours-minutes-



seconds, stores the result in a time structure, and finally



displays the result in 12:59:59 forma

Write a function named "reverse" that takes as its arguments the following:


(1) an array of floating point values;


(2) an integer that tells how many floating point values are in the array.


The function must reverse the order of the values in the array. Thus, for


example, if the array that's passed to


the function looks like this:


0 1 2 3 4


5.8 | 2.6 | 9.0 | 3.4 | 7.1


then when the function returns, the array will have been modified so that it


looks like this:


0 1 2 3 4


7.1 | 3.4 | 9.0 | 2.6 | 5.8


The function should not return any value.

The students’ IDs and test answers are



stored in a file. The first entry in the file contains answers to the test in the form:



TFFTFFTTTTFFTFTFTFTT



Every other entry in the file is the student ID, followed by a blank, fol- lowed by the student’s responses. For example,



the entry:



ABC54301 TFTFTFTT TFTFTFFTTFT



indicates that the student ID is ABC54301 and the answer to question 1 is True, the answer to question 2 is False, and



so on. This student did not answer question 9. The exam has 20 questions, and the class has more than 150 students.



Each correct answer is awarded two points, each wrong answer gets one point deducted, and no answer gets zero



points.



Write a program that processes the test data. The output should be the student’s ID, followed by the answers, followed



by the test score, followed by the test grade. Assume the following grade scale: 90%–100%, A; 80%–89.99%, B; 70%–



79.99%, C; 60%–69.99%, D; and 0%–59.99%, F.

Given an array A of N integers and two integers X and Y, find the number of integers in the array that are both less than or equal to X and divisible by Y.


2 dimentional arrays that determines the odd number among 12 inputs



Instructions:



An array containing 10 predefined double values are already provided for you in the code editor. Print each of the element out in separate lines, starting from the last array element down to the first.


Each outputted value must also only show up to two decimal places.



Output



Multiple lines containing a float number.



5.10


5.50


4.00


4.02


3.00


3.66


2.50


2.20


1.21

Jack `N Poy


The winner is selected depending on the following rules:

  • Rock beats Scissors
  • Scissors beats Paper
  • Paper beats Rock
  • If both players chose the same option, then it's a tie

Instructions:

  1. In the code editor, you are provided with an enum called option which contains three possible named values:
  2. ROCK - 'r'
  3. PAPER - 'p'
  4. SCISSORS - 's'
  5. Your task is to ask two users for there chosen options. And then based on their options, determine the winner.

Input


1. Option selected by Player 1

2. Option selected by Player 2

Output

If Player 1 wins, print the message "Player 1 wins!"

If Player 2 wins, print the message "Player 2 wins!"

If it's a tie, print the message "It's a tie!"

Player·1:·r
Player·2:·p
Player·2·wins!




Dealing With Months

by CodeChum Admin

We're done dealing with days. It's time to step up and now deal with months!


Instructions:

  1. In the code editor, you are provided with a code in the main() which has 12 cout's. Each cout prints a month with its corresponding value. For this program, January is 1, February is 2, March is 3, and so on. When you run the initial code, you will encounter errors because these month names that have been printed don't exist yet.
  2. Your task is to create an enum data type which contains these month names as values so that when we run the code, there will be no more error.
  3. Do not edit anything in the main().

Output


January·=·1
February·=·2
March·=·3
April·=·4
May·=·5
June·=·6
July·=·7
August·=·8
September·=·9
October·=·10
November·=·11
December·=·12

Using Pointer


The students’ IDs and test answers are


stored in a file. The first entry in the file contains answers to the test in the form:


TFFTFFTTTTFFTFTFTFTT


Every other entry in the file is the student ID, followed by a blank, fol- lowed by the student’s responses. For example,


the entry:


ABC54301 TFTFTFTT TFTFTFFTTFT


indicates that the student ID is ABC54301 and the answer to question 1 is True, the answer to question 2 is False, and


so on. The exam has 20 questions, and the class has more than 150 students.


Each correct answer is awarded two points, each wrong answer gets one point deducted, and no answer gets zero


points.


Write a program that processes the test data. The output should be the student’s ID, followed by the answers, followed


by the test score, followed by the test grade. Assume the following grade scale: 90%–100%, A; 80%–89.99%, B; 70%–


79.99%, C; 60%–69.99%, D; and 0%–59.99%, F.

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS