I have no idea how to even start. It's past midnight now :(
I just need a hint; I obviously have to write the program myself.
Type: Posts; User: ieatcalculus
I have no idea how to even start. It's past midnight now :(
I just need a hint; I obviously have to write the program myself.
Challenging us on the last day of class with the ultimate question, my professor gave us this problem.
It's nearing midnight (11:55), and I've completely given up hope.
This is the problem:
...
How would I fix this program so that the user is allowed to input any amount of numbers into the array? I'm absolutely confused.
Thanks in advance!
#include <iostream>
using namespace std;
...
Oh gosh, there was actually a predefined function all along..? (Fixed!)
Thank you again, laserlight! You've been more than helpful ;)
Right. Regardless, it still won't work. The error message says "variable-sized object 'testscores' may not be initialized"
what? like this?: (It doesn't work?)
#include <iostream>
using namespace std;
double getAverage(int testscores[], int num_elements);
int main ()
(For easier understanding, I simplified this problem*:)
In short, I'm trying to write a program that has a function, getAverage(), which should calculate and return the average of the values...
If you enter 'setprecision(25)', it gives you a lot of trailing zeroes. I think that 100 is simply too big.
Regardless, here's the code (It gives you a blank screen, but if you make the number...
Oh wow, I really did overcomplicate this! Thanks for your help (:
That makes sense.
Hypothetically speaking, for the for loop, what would I replace
for (int i = 0; i <= 8; i++)
with if I wanted to print out the entire string?
(That is, do I...
Regarding the spacing, why is it that
for (int i = 0; i <= 10; i++)
{
cout << strng[i];
}
Wow that was a fast edit! I fixed it; thank you!
I started taking a C++ class two weeks ago, so I'm relatively new to this. I'm trying to grasp the fundamentals of arrays, but I'm absolutely stuck with this problem.
I'm trying to write a program...