answersLogoWhite

0


Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: List two reasons why STD are considered epidemic?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Write a C plus plus program to move a node to nth position in forward?

#include<iostream> #include<forward_list> void print (std::forward_list<unsigned>& list) { for (std::forward_list<unsigned>::iterator i=list.begin(); i!=list.end(); ++i) std::cout << *i << '\t'; std::cout << std::endl; } bool insert (std::forward_list<unsigned>& list, unsigned value, unsigned position) { // there is no 0th position if (position list.end()) return false; // i is the nth-1 node list.insert_after (i, value); return true; } bool move (std::forward_list<unsigned>& list, unsigned value, unsigned position) { list.remove (value); return (insert (list, value, position)); } int main() { // initialise a forward list with 9 unique values 1, 2, 3, ..., 8, 9 std::forward_list<unsigned> list; for (unsigned i=1; i<=10; ++i) insert (list, i, i); std::cout << "initial list\n" << std::endl; print (list ); // insert the value 11 at the 6th position in the list insert (list, 11 , 6); std::cout << "\nafter inserting the value 11 at position 6\n" << std::endl; print (list); // move the value 11 to position 11 in the list move (list, 11, 11); std::cout << "\nafter moving the value 11 to position 11\n" << std::endl; print (list); }


C plus plus program for displaying position and frequency of a number in the given list?

#include<iostream> #include<vector> #include<list> #include<map> #include<time.h> int main() { srand ((unsigned)time(nullptr)); // Create a list of 100 values in the range 0 to 9. std::cout << "Number list:\t"; std::list<size_t> numbers; for (size_t i=0; i<100; ++i) { numbers.push_back (rand()%10); std::cout << numbers.back() << ' '; } std::cout << '\n' << std::endl; // Determine position(s) of each number. std::map<size_t, std::vector<size_t>> map; size_t pos = 0; for (auto it=numbers.begin(); it!=numbers.end(); ++it) map[*it].push_back(pos++); // Print number, frequency and position(s). for (auto it=map.begin(); it!=map.end(); ++it) { std::cout << "Number:\t\t" << (*it).first << std::endl; std::cout << "Frequency:\t" << (*it).second.size() << std::endl; std::cout << "Postions:\t"; const std::vector<size_t>& positions = (*it).second; for (auto it=positions.begin(); it!=positions.end(); ++it) std::cout << (*it) << ' '; std::cout << '\n' << std::endl; } }


Write an interactive c plus plus program to create a linear linked list of customer names their telephone numbers?

#include<list> #include<string> struct Customer { std::string m_name; std::string m_phone; Customer (std::string name, std::string phone): m_name(name), m_phone(phone) {} // ... }; int main() { std::list<Customer> customers; customers.push_back ("Joe Bloggs", "555 7465"); customers.push_back ("Dan Mann", "555 3458"); // ... }


C plus plus array-based lists?

If you mean an array where each element is a list, then the STL is your friend. To create an array of lists of any type T, use the following declaration: std::vector<std::list<T>> my_array_of_lists;


How to program set Cardinality in C plus plus?

The cardinality of a set is simply the number of elements in the set. If the set is represented by an STL sequence container (such as std::array, std::vector, std::list or std::set), then the container's size() member function will return the cardinality. For example: std::vector<int> set {2,3,5,7,11,13}; size_t cardinality = set.size(); assert (cardinality == 6);

Related questions

Why are STD's in the US considered a hidden epidemic?

STD's are considered a hidden epidemic due to their taboo nature. Nobody talks about them because they are so private. Furthermore, many people with them don't even know they have them.


How do you sort a names using a linked list in C plus plus?

Merge sort is considered the most efficient algorithm for sorting lists. #include<iostream> // std::cout, std::endl #include<iomanip> // std::setw #include<list> // std::list #include<random> // Random number generator (RNG) #include<ctime> // C-style time (used by RNG) template<typename T> void merge_lists (std::list<T>& left, std::list<T>& right) { std::list<T> result; while (!left.empty() && !right.empty()) { if (right.front() < left.front()) { result.push_back (right.front()); right.pop_front(); } else { result.push_back (left.front()); left.pop_front(); } } while (!left.empty()) { result.push_back (left.front()); left.pop_front(); } while (!right.empty()) { result.push_back (right.front()); right.pop_front(); } left = std::move (result); } template<typename T> void merge_sort (std::list<T>& list) { // A list of 1 or none is already sorted. if (list.size() < 2) return; // Divide the list into two sublists. const size_t size = list.size() / 2; std::list<T> right; while (size < list.size()) { right.push_front (list.back()); list.pop_back(); } // Recursively sort each sublist. merge_sort (list); merge_sort (right); // Merge the sublists. merge_lists (list, right); } int main () { // Pseudo-random number generator (all 2-digit values). std::default_random_engine generator ((unsigned) time (0)); std::uniform_int_distribution<size_t> distribution (10, 99); // Generate a list of 25 random values (may include duplicates). std::list<size_t> list; while (list.size() != 25) list.push_back (distribution (generator)); // Print the list. std::cout << std::setw (9) << "Unsorted:"; for (auto value : list) std::cout << std::setw (3) << value; std::cout << std::endl; // Sort the list. merge_sort (list); // Print the list. std::cout << std::setw (9) << "Sorted:"; for (auto value : list) std::cout << std::setw (3) << value; std::cout << std::endl; }


Write a C plus plus program to move a node to nth position in forward?

#include<iostream> #include<forward_list> void print (std::forward_list<unsigned>& list) { for (std::forward_list<unsigned>::iterator i=list.begin(); i!=list.end(); ++i) std::cout << *i << '\t'; std::cout << std::endl; } bool insert (std::forward_list<unsigned>& list, unsigned value, unsigned position) { // there is no 0th position if (position list.end()) return false; // i is the nth-1 node list.insert_after (i, value); return true; } bool move (std::forward_list<unsigned>& list, unsigned value, unsigned position) { list.remove (value); return (insert (list, value, position)); } int main() { // initialise a forward list with 9 unique values 1, 2, 3, ..., 8, 9 std::forward_list<unsigned> list; for (unsigned i=1; i<=10; ++i) insert (list, i, i); std::cout << "initial list\n" << std::endl; print (list ); // insert the value 11 at the 6th position in the list insert (list, 11 , 6); std::cout << "\nafter inserting the value 11 at position 6\n" << std::endl; print (list); // move the value 11 to position 11 in the list move (list, 11, 11); std::cout << "\nafter moving the value 11 to position 11\n" << std::endl; print (list); }


What to do if 10Th std mark list is lost?

b.rekha


C plus plus program for displaying position and frequency of a number in the given list?

#include<iostream> #include<vector> #include<list> #include<map> #include<time.h> int main() { srand ((unsigned)time(nullptr)); // Create a list of 100 values in the range 0 to 9. std::cout << "Number list:\t"; std::list<size_t> numbers; for (size_t i=0; i<100; ++i) { numbers.push_back (rand()%10); std::cout << numbers.back() << ' '; } std::cout << '\n' << std::endl; // Determine position(s) of each number. std::map<size_t, std::vector<size_t>> map; size_t pos = 0; for (auto it=numbers.begin(); it!=numbers.end(); ++it) map[*it].push_back(pos++); // Print number, frequency and position(s). for (auto it=map.begin(); it!=map.end(); ++it) { std::cout << "Number:\t\t" << (*it).first << std::endl; std::cout << "Frequency:\t" << (*it).second.size() << std::endl; std::cout << "Postions:\t"; const std::vector<size_t>& positions = (*it).second; for (auto it=positions.begin(); it!=positions.end(); ++it) std::cout << (*it) << ' '; std::cout << '\n' << std::endl; } }


How do you convert a list to a paragraph with a comma separating each item in the list?

The following example shows one possible solution using C++. The list_to_csv function performs the initial conversion, converting a given list to a comma-separated values (CSV) string. Thus the list {a, b, c} would become the string "a, b, c". The list_to_paragraph function takes a list, converts it to a CSV and then formats the CSV for output using "and" or "or" for the final element. Thus the list {a, b, c} becomes "a, b and c" or "a, b or c" depending on the and_or value (with "and" being the default). Note the paragraph is not terminated with a period or a new line character since it would be useful to include the paragraph in another string which may itself be a paragraph. This is demonstrated by the print_list helper function which prints a given list in both "and" and "or" variants as part of two larger paragraphs (in this case just a single-line paragraph). Finally, the main function tests the program, starting with an empty list and building up to a list of 4 elements, printing each in turn. #include<iostream> #include<list> #include<sstream> enum class and_or {and, or}; std::string list_to_csv (const std::list<std::string>& list) { std::stringstream ss; auto it=list.cbegin(); while (it!=list.cend()) { ss << *it++; if (it!=list.cend()) ss << ", "; } return ss.str(); } std::string list_to_paragraph (std::string csv, const and_or andor = and_or::and) { size_t pos = csv.find_last_of(','); if (pos != std::string::npos) { csv.replace(pos, 1, " "); csv.insert(pos+1, andor==and_or::and?"and":"or"); } return csv; } void print_list (const std::list<std::string>& list) { std::cout << "List of " << list.size() << " item(s): {" << csv_to_paragraph(list_to_csv(list), and_or::and) << "}\n"; std::cout << "List of " << list.size() << " item(s): {" << csv_to_paragraph(list_to_csv(list), and_or::or) << "}\n"; } int main(){ std::list<std::string> list; print_list (list); list.push_back ("a"); print_list (list); list.push_back ("b"); print_list (list); list.push_back ("c"); print_list (list); list.push_back ("d"); print_list (list); }


Write an interactive c plus plus program to create a linear linked list of customer names their telephone numbers?

#include<list> #include<string> struct Customer { std::string m_name; std::string m_phone; Customer (std::string name, std::string phone): m_name(name), m_phone(phone) {} // ... }; int main() { std::list<Customer> customers; customers.push_back ("Joe Bloggs", "555 7465"); customers.push_back ("Dan Mann", "555 3458"); // ... }


Is MRSA considered an STD?

MRSA is not considered an STD. Although you might get it from sex, that's not its primary mode of transmission. You can get the common cold or strep throat during sex, also, but we don't consider those STDs.


C plus plus array-based lists?

If you mean an array where each element is a list, then the STL is your friend. To create an array of lists of any type T, use the following declaration: std::vector<std::list<T>> my_array_of_lists;


Is it possible to have vaginal swelling due to bacterial infection that is NOT a STD?

It could be alot of things! The only way to make sure is to see your doctor! Good luck


What is sudonis?

I suspect you mean pseudomonas (sounds like sudomonas) which is a proteobacteria and can be considered an STD.


How come you have no STD but pain during intercourse?

There are several reasons why you may have pain during intercourse even though you do not have an STD. You may have a simple infection, by visiting your doctor you will be able to get a full and complete diagnosis.