Question: I have this C++ code #include #include #include using namespace std; double median(std::vector vec){ int size = vec.size(); if(size > 0 ){ std::sort(vec.begin(),vec.end()); int middle

I have this C++ code

#include #include

#include using namespace std;

double median(std::vector vec){ int size = vec.size(); if(size > 0 ){ std::sort(vec.begin(),vec.end());

int middle = size / 2; double median = 0.0; if(size % 2 == 0){ median = (vec[middle] + vec[middle+1]) / (double)2; }else{ median = vec[middle]; } return median; } return 0.0; }

int main(){ bool keep_on=true; while(keep_on){ vector v; double in_val = 0; cout<<"Please insert numeric values to find the median:(non-numeric value to terminate input)"; while(cin >> in_val){ v.push_back(in_val); } cin.clear(); cin.ignore(1,' ');

cout<<"Median: "<

int again = 0; while(true){ cout<<"1: Go again?"<>again; if(again == 1) break; else if(again == 2){ keep_on = false; break; } else{ cout<<"Input only 1 or 2 please"<

this code runs perfectly on other compilers but I am required to use Gnome Terminal 2.7.3 and it shows me this error

CPP test test.cpp*** test.cpp:7: instantiated from here test.cpp:7: instantiated from here test.cpp:7: instantiated from here test.cpp:11: instantiated from here test.cpp:8: instantiated from here Can you tell me what this error means? and how to fix it so the code runs on the gnome terminal?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!