How would I begin writing a function to fit these instructions?
1. Create an integer variable named ‘listSize’ and initialize the value to 1000.
2. Open an output file named ‘RESULTS.csv’. The first line of this file should be the column headings: ‘List Size’, ‘Selection Sort Data Swap Time’, ‘Selection Sort Node Swap Time’, ’Insertion Sort Node Swap Time’, ‘Quick Sort Node Swap Time’.
3. Using the rand () function, fill 4 doubly linked list of integers with the number of variables corresponding to the ‘listSize’ variable. The list should be created using the push operator. The values generated by rand () should be numbers from 1-500,000. The list should be named; selectionListData, selectionListNode, insertionListNode, and quickListNode.
PLEASE no bullying right now. If you don't want to help just close out of the forum.
#include <fstream>
#include <list>
#include <cstdlib>
void function(){
int listSize = 1000;
// Just use ofstream. open file.
list selectionListData, selectionListNode, insertionListNode, quickListNode; // obviously not really valid code, but you get it.
// begin for
// push random number into first list.
// end for
// begin for
// push random number into second list.
// end for
// begin for
// push random number into third list.
// end for
// begin for
// push random number into fourth list.
// end for
return;
}
int main(){
function();
}