Description
Write C++ programs to perform the following tasks. In many of the program descriptions below, example inputs and outputs are provided.
- 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.
Enter integers: 2 1 55 3 2 1 4 4 2 2 55
Exclusive: 3
- 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. 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
- 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. Another example is given below.
Enter in a start time: 1415 Enter in a duration: 50 End time is: 1505
Textbook & Other Resources
Students may find the following sections of the textbook useful for this assignment:
- DEITEL 2.1–2.8
- DEITEL 4.1–4.15
- DEITEL 5.1–5.14
Students may also find the following resources useful for this assignment:
- std::cout – http://en.cppreference.com/w/cpp/io/cout
- std::cin – http://en.cppreference.com/w/cpp/io/cin
- std::getline – http://en.cppreference.com/w/cpp/string/basic_string/getline std::stringstream – http://en.cppreference.com/w/cpp/io/basic_stringstream





