



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




double* addValue (double* arr_in, int& size, double newValue);
double* deleteValue(double* arr_in, int& size, double deleteValue);
void printArr(double* arr_in, int size);
void main() { int size; double* arr_in;
//read size and create array printArr(arr_in, size); arr_in = addEntry(arr_in, size, 9.1); printArr(arr_in, size); arr_in = addEntry(arr_in, size, 9.2); printArr(arr_in, size); arr_in = deleteEntry(arr_in, size, 9.1); printArr(arr_in, size);
arr_in = deleteEntry(arr_in, size, -100); printArr(arr_in, size);
#include
using namespace std; double* del(double* arr, int& size, double deleteValue); double* addValue(double* arr, int& size, double newValue); void printArr(double* arr, int size);
void main() { int size, i = 0; cout << "Enter the size of the array: " << endl; cin >> size; double * arr; arr = new double[size]; double newValue; double deleteValue;
cout << "Enter the values you want: " << endl; for (i = 0; i < size; i++) { cin >> arr[i]; }
cout << "The current array is: " << endl; printArr(arr, size);
cout << "Enter the new value that you want to add: " << endl; cin >> newValue;
cout << "The added array is: " << endl; addValue(arr, size, newValue);
cout << "Enter the value that you want to delete: " << endl; cin >> deleteValue; cout << "The deleted array is: " << endl; del(arr, size, deleteValue);
return 0; }
void printArr(double* arr, int size)
{ for (int x = 0; x < size; x++) { cout << arr[x] << endl; } //is this supposed to print for all? how if diff. sizes?
#include
using namespace std; double* deleteValue(double* arr, int& size, double deleteValue); double* addValue(double* arr, int& size, double newValue); void printArr(double* arr, int &size);
void main() { int size; cout << "Enter the size of the array: " << endl; cin >> size; double * arr; arr = new double[size];
double newValue;
int i = 0;
cout << "Enter the values you want: " << endl; for (i = 0; i < size; i++) { cin >> arr[i];
cout << "The current array is: " << endl; printArr(arr, size);
cout << "Enter the new value that you want to add: " << endl; cin >> newValue;
cout << "The added array is: " << endl; arr = addValue(arr, size, newValue); printArr(arr, size);
cout << "Enter the new value that you want to add: " << endl; cin >> newValue;
cout << "The added array is: " << endl; arr = addValue(arr, size, newValue); printArr(arr, size);
double* addValue(double* arr, int& size, double newValue) { double *arr2; size++; arr2 = new double[size];
for (int j = 0; j < (size - 1); j++) { arr2[j] = arr[j]; }