Question: Write C++ programs to perform the following tasks. In many of the program descriptions below, example input and output is provided. NOTE: You dont need

Write C++ programs to perform the following tasks. In many of the program descriptions below, example input and output is provided. NOTE: You dont need arrays to solve any of these problems. You should NOT use arrays to solve any of these problems. You should also not use string manipulation beyond extraction from an std::stringstream, if needed.

exclusive.cpp: Let the user input an odd number of positive integers, space separated, on a single line (as seen below). Assume that each integer except for one, the exclusive integer, appears an even number of times in the input. Your program should output the exclusive integer. Remember, you do not need nor should you use an array to solve this problem. You should also not use string manipulation beyond extraction from an std::stringstream, if needed.

 Enter integers: 2 1 55 3 2 1 4 4 2 2 55 Exclusive: 3 

primesum.cpp: Let the user input a single integer n where 1 n 100000. Your program should print the sum of the first n prime numbers. Remember, you do not need nor should you use an array to solve this problem. In the first example below, the first 5 prime numbers are 2, 3, 5, 7, and 11.

 Enter integer: 5 Prime sum: 28 
 Enter integer: 100000 Prime sum: 62260698721 

armstrong.cpp: Write a program that prints out all Armstrong numbers, each on their own line. An Armstrong number is a three digit integer such that the sum of the cubes of its digits is equal to the number itself. For example, 371 is an Armstrong number since 33 + 73 + 13 = 371. Remember, you do not need nor should you use an array to solve this problem.

bitsum.cpp: Let the user input a single integer n where 1 n 18446744073709551615. Your program should print the number of 1 bits in the binary representation of n. Remember, you do not need nor should you use an array to solve this problem. In the example below, the binary representation of 115 is 1110011. Remember, you should not use string manipulation beyond extraction from an std::stringstream, if needed.

 Enter integer: 115 Bit sum: 5 

endtime.cpp: Write a program to read two integers with the following significance. The first integer value represents a time of day on a 24 hour clock, so that 1245 represents quarter to one mid-day, for example. The second integer represents a time duration in a similar way, so that 345 represents three hours and 45 minutes. This duration is to be added to the first time, and the result printed out in the same notation, in this case 1630 which is the time 3 hours and 45 minutes after 12.45.

 Enter in a start time: 1415 Enter in a duration: 50  End time is: 1505 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!