<commit_before>/************************************************************
COSC 501
<NAME>
19 NOV 2013                                   Due 25 NOV 2013
Problem: Create a 1-dimensional array with n elements; get
the size of the array as user input (validate!), max size
should be 10 (declared as class constant). Perform a
variety of functions with the array.
Algorithm: Get array size from user, validate, get values,
perform functions.
************************************************************/

#include <iostream>
using namespace std;



int main()
{
char runQuestion = 'Y';
int i;

cout << "Do you want to start(Y/N): ";
cin >> runQuestion;

while (runQuestion == 'Y' || runQuestion == 'y')
{
	// declare array with pointers
	struct node
	{
		double data;
		node *next;
	};

	node *q, *head;
	head = new node;
	head->data = 0;
	head->next = NULL;
	node *p;
	p = head;

	cin >> i;
	while (i != -1)
	{
		q = new node;
		q->data = i;
		head->data++;
		q->next = NULL;
		p->next = q;
		p = q;
		cin >> i;
	}

	// print
	cout << "The node elements are:\n";

	p = head->next;
	while (p != NULL)
	{
		cout << p->data << endl;
		p = p->next;
	}

	node *t = new node;
	t->data = 25;
	t->next = q->next;
	q->next = t;

	p = head->next;
	if (p != NULL && p->data <=25)
	{
		cout << p->data << endl;
		p = p->next;
	}
	else if (p != NULL)
	{

	}
	

	cout << "Do you want to continue(Y/N): ";
	cin >> runQuestion;
	}



	return 0;
}<commit_msg>linked list working<commit_after>/************************************************************
COSC 501
<NAME>
19 NOV 2013                                   Due 25 NOV 2013
Problem: Create a 1-dimensional array with n elements; get
the size of the array as user input (validate!), max size
should be 10 (declared as class constant). Perform a
variety of functions with the array.
Algorithm: Get array size from user, validate, get values,
perform functions.
************************************************************/

#include <iostream>
using namespace std;



int main()
{
char runQuestion = 'Y';

cout << "Do you want to start(Y/N): ";
cin >> runQuestion;

while (runQuestion == 'Y' || runQuestion == 'y')
{
	// declare array with pointers
	struct node
	{
		double data;
		node *next;
	};

	node *head = NULL; // set up header null to first pointer
	
	node *pointerP, *pointerQ; // pointers
	
	for (int i = 0; i < 10; i++)
	{
		// Reserve space for new node and fill it with data 
		pointerP = new node;
		cout << "Please enter a number: ";
		cin >> pointerP->data;
		pointerP->next = NULL;

		// Set up link to this node 
		if (head == NULL)
			head = pointerP;
		else
		{
			pointerQ = head; // We know this is not NULL - list not empty! 
			while (pointerQ->next != NULL)
				pointerQ = pointerQ->next; // Move to next link in chain 
			pointerQ->next = pointerP;
		}
	}

	// print
	cout << "The node elements are:\n";

	pointerP = head;
	while (pointerP != NULL)
	{
		cout << pointerP->data << endl;
		pointerP = pointerP->next;
	}

	// set up another node to add
	//node *pointerT = new node;
	//pointerT->data = 25; // change to cin
	//pointerT->next = pointerQ->next;
	//pointerQ->next = pointerT;

	//pointerP = head->next;
	//if (pointerP != NULL && p->data <=25)
	//{
	//	cout << p->data << endl;
	//	pointerP = p->next;
	//}
	//else if (pointerP != NULL)
	//{

	//}
	//

	cout << "Do you want to continue(Y/N): ";
	cin >> runQuestion;
	}



	return 0;
}
{'fraction_non_alphanumeric': 0.21078862503664614, 'fraction_numerical': 0.014951627088830254, 'mean_word_length': 2.829405162738496, 'pattern_counts': {'":': 0, '<': 40, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2208217', 'n_tokens_mistral': 1262, 'n_tokens_neox': 1132, 'n_words': 409}