Hello, everyone my brother was given an assignment to do in C, I know C++ and C# so I write it out in C++ to get a better understanding of what the brief wants us to do.
I have the program working, but with modifications to the brief.
Write a program that calculates the Root-Mean-Square (RMS) of a
sequence of numbers whose length and content are determined by the
user. The RMS calculation should be done in a function of prototype
double RMS(double *x, int N), where N is the number of elements
in the array x. Demonstrate its use in a main function which prompts
the user for the length of the sequence, and then the values of this
sequence (e.g. if the user gives 3 as a sequence length, he/she should
thereafter be asked for 3 values).
This is what I wrote
What Im not sure of is the prototype in the brief.
double RMS(double x, int N);
using namespace std;
cout << "How many number's should there be." << endl;
cin >> arraysize;
for(int i = 0; i < arraysize; ++i)
cout << "Enter number " << i << endl;
cin >> content;
array[i] += content;
total += content;
cout << RMS(total, arraysize);
double RMS(double x, int N)
result = x * x / N;
double RMS(double *x, int N)
Is double *x a pointer or does he just mean array because they are similar but not the same.
I did it all from memory so go easy on me if there is some noobish mistakes the last time I used C++ was a long time ago.