Hello everyone,
This is my first time using this forum, I dont know how Im supposed to ask questions, or how does this work. Anyways, I kinda need an explanation about my code. First of all, is it possible to call a function, and within that function read the same values as the ones inputted for the main function? I am trying to use the same values of age, for the function Im trying to call, but I dont know how to make it. Can you guys check the end of the code, I wrote there what I am trying to say here.
#include <iostream>
#include <cmath>
using namespace std;
void mode (int arr[], int size)
{
int mode [500];
int frequency, maxFrequency = {0};
int a = 1;
for (int i = 0; i < size; i++)
{
for (int j = 0; j < size; j++)
{
if (arr[i] == arr[j])
frequency++;
}
cout << "The Mean of this set of data is: " << mean << endl;
cout << "The Standard Deviation of this set of data is: " << sDeviation << endl;
// Here, let's say I input already 6 integers, for example, 24, 25, 26, 24, 21, 24, with these values I can calculate the mean and sdeviation, but how can I call the function mode to read these same values? This is what I am having trouble with. Hope someone can help me. Thank you in advance.