#include <iostream>
#include <list>
#include <iterator>
using namespace std;
void printList(list <string> cities)
{
list <string> :: iterator it;
for(it = cities.begin(); it != cities.end(); ++it)
cout << *it << " ";
cout << '\n';
}
void append(list <string> &cities, string city) {
cities.push_back(city);
}
int main()
{
list <string> cities;
append(cities, "Stockton");
append(cities, "Lodi");
append(cities, "Lathrop");
append(cities, "Manteca");
append(cities, "Tracy");
printList(cities);
return 0;
}

In c++, Design a program using a list that is 5 elements long. Use city names...
Write in c++ please
Imagine you are writing a program to manage a shopping list. Each shopping list item is represented by a string stored in a container. Your design requires a print function that prints out the contents of the shopping list Using a vector to hold the shopping list items, write a print function to print out the contents of a vector of strings. Test your print function with a main program that does the following: 1. Create...
Design a program using Python and using from flask Import flask that generates a lottery number but in a website.. The program should have an Integer array with 9 elements. Write a loop that steps through the array, randomly generating a number in the range of 0 through 42 for each element. (Use the random function) Then write another loop that displays the contents of the array. Each number should be displayed as a list, the numbers should be generated...
Please help!!
(C++ PROGRAM)
You will design an online contact list to keep track of names
and phone numbers.
·
a. Define a class contactList that can store a name and up to 3
phone numbers (use an array for the phone numbers). Use
constructors to automatically initialize the member variables.
b.Add the following operations to your program:
i. Add a new contact. Ask the user to enter the name and up to 3
phone numbers.
ii. Delete a contact...
Homework 1- Merge Files: 1. Design a class named MergeFiles 1 Three file names are passed as command-line arguments to MergeFiles as follows: java MergeFiles filel file2 mergedFile II. MergeFiles reads names stored in files file and file2 III. Merges the two list of names into a single list IV. Sorts that single list V. Ignores repetitions VI. Writes the sorted, free-of-repetitions list to a new file named mergedFile.txt VII. The names in all three files are stored as one...
C++ exercise: Lottery Number Generator Design a program that generates a 7-digit lottery number. The program should have an Integer array with 7 elements. Write a loop that steps through the array, randomly generating a number in the range of 0 through 9 for each element. (Use the random function that was discussed in Chapter 6.) Then write another loop that displays the contents of the array.
in c++
Program 1 Write a program that sorts a vector of names alphabetically using the selection sort and then searches the vector for a specific name using binary search. To do that, you need to write three functions I. void selSort (vector string &v: sorts the vector using selection sort 2. void display (const vector <string & v): displays the vector contents . int binSearch (const vector <ing& v, string key): searches the vector for a key returns the...
using C++, NOT C language 1. Write a function called insert() to insert a node to the beginning of a linked list. The data is passed into the function. For example insert(8) will insert a node at the beginning of the list with the number 8 in the data field. Each node in the linked list is a ListNode struct as discussed in class. 2. Write a function called print() that will traverse the entire linked list and print out...
Use Python Spyder to answer: First List – Loop (one that you created in lab 1 or any new list) • Repeat First List, but this time use a loop to print out each value in the list. First Neat List - Loop • Repeat First Neat List, but this time use a loop to print out your statements. Make sure you are writing the same sentence for all values in your list. Loops are not effective when you are...
Design a class for python named PersonData with the following member variables: lastName firstName address city state zip phone Write the appropriate accessor and mutator functions for these member variables. Next, design a class named CustomerData , which is derived from the PersonData class. The CustomerData class should have the following member variables: customerNumber mailingList The customerNumber variable will be used to hold a unique integer for each customer. The mailingList variable should be a bool . It will be...