Question
Could someone help me to JUST COMPLETE my code below please. The assignment asks that we have seperate header and cpp files it just wont
Could someone help me to JUST COMPLETE my code below please. The assignment asks that we have seperate header and cpp files it just wont compile right.
My code so far
main.cpp
#include
using namespace std;
//Function prototypes void data(int[],int);
int main() { //Declare variables int t,num,elements[50],key;
//Prompt and read input from the user cout>num;
while(num>50) { cout>num; }
//Call the methods data(elements,num); Display(elements,num,"unsorted"); sortArray(elements,num); Display(elements,num,"sorted");
cout>key;
t=binarySearch(elements,num,key); if(t
sort.cpp
#include
void Display(int elements[],int n,string d) { int i; cout
void sortArray (int elements[], int size) { bool swap; int temp;
do { swap=false; for (int count =0; count elements[count+1]) { temp = elements[count]; elements[count]=elements[count+1]; elements[count+1]=temp; swap=true; } } } while (swap); }
sort.hh
#ifndef _SORT_HH_INCLUDED // is myheader.h already included? #define _SORT_HH_INCLUDED // define this so we know it's included
using namespace std; //Function prototypes void sortArray(int[],int); void Display(int[],int,string);
#endif
search.cpp
#include
int binarySearch(int[],int,int);
#include
int binarySearch(int elements[], int size, int value) { int first=0, last = size-1, middle, position = -1; bool found =false;
while (!found && first value) last - middle-1; else first = middle +1; } return position;
}
search.h
#ifndef _SEARCH_H_INCLUDED // is myheader.h already included? #define _SEARCH_H_INCLUDED // define this so we know it's included //Function prototypes
int binarySearch(int[],int,int);
#endif
statistics.cpp
#include
//Method definition of mean: Recall that the mean is //the sum of the data values divided by the number //of pieces of data.
double mean(int elements[],int n) { int i,sum=0; for(i=0;i statistics.hh #ifndef _STATS_HH_INCLUDED // is myheader.h already included? #define _STATS_HH_INCLUDED // define this so we know it's included //Function prototypes double mean(int[],int); #endif
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started