#include <iostream>
usingnamespace std;
int main()
{
int sum = 0;
int average = 0;
int array[10] = {1,2,3,4,5,6,7,8,9,10};
for (int i = 0; i < 10; ++i) sum += array[i];
average = sum/10;
cout << "The average is: "<< average;
return 0;
}
Remember that cout is buffered, so just because you output something to it doesn't mean it gets displayed right away. You can output a bunch of stuff to count and it won't be visible until cout internally moves the data from the buffer to the actual display. That's what flushing does.
He said he was just getting a black screen, so it made sense to me that output wasn't flushing.
none of that worked all the debugger says is
So the window closing right away before you can see anything?
Okay, but why is the black screen showing up I can't run the program? I debug it and the output shows a black screen. I can't type any information in to test it. It just pops up and disappears and shows that 0 (0X0). The program is suppose to let the user pick 10 numbers and find the average of them using an array and a function. Any of the ideas on how to test the program.
Okay, but why is the black screen showing up I can't run the program? I debug it and the output shows a black screen. I can't type any information in to test it. It just pops up and disappears and shows that 0 (0X0). The program is suppose to let the user pick 10 numbers and find the average of them using an array and a function. Any of the ideas on how to test the program.