# 11 write a function that will use vectors to allow

• No School
• AA 1
• 4

This preview shows page 2 - 4 out of 4 pages.

#11 Write a function that will use vectors to allow the user to input 15 numbers, then sort it from highest to lowest. After doing that, remove all the numbers but the top 5 and output the vector. (example: if the user enters 1, 7, 4, 15, 74, 2, 4, 61, 9, 6, 4, 5, 2, 4, and 6, the output should be 74, 61, 15, 9, and 7). Uses vectors and vector sorting. #12 Code a program that will take a random line of text from an input file and display it to the screen. Make sure to make it so that your program generates a different number each time. Uses files, random, and strings. #13 Code a program that will either see if a word has a letter twice in a row (for example: paddle, tree, balloon). Uses strings and arrays. #14 Code a program that will pass text from an input file to an output file, not including a letter picked by the user (for example, ‘Hello there,’ could become ‘ello tere’ or ‘Hllo thr’). Uses files, strings, and arrays. #15 Code a program that will count the number of words in a file that start with a vowel and append that number to the end of the input file. Uses files, strings, and arrays. #16 Code a question from the Test 1 Review sheet using only pointers and the new operator (for example, if you need an integer the code would be int *num = new int; and for a character it would be char *letter = new char;). Uses pointers and dynamic memory (memory in the heap).

Subscribe to view the full document.

Correct the error and verify the output: #1 Should output 77: int *p, num = 7; p = num; cout << *p << num << endl; #2 In both cases, Hello! should be a c-string: char message[7] = { 'H' , 'e' , 'l' , 'l' , 'o' , '!' }; char Message[7] = { "Hello!" }; #3 Should output Hi: char
• Fall '19
• Array, Vector Motors, Variable-length array

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes