When I compile though I get an exe that does nothing
thanks in advance
#include <fstream>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
//prototyps
int displaymode(ostream&, int[]);
void writeOutput(ostream&,int[]);
int main()
{
//creates array
int data[10] = {5,6,2,5,1,7,5,9,4,3};
int displaymode();
void writeOutput();
system("PAUSE");
return EXIT_SUCCESS;
}
int displaymode(ostream &output, int data[], int data_quantity)
{
//find mode
int mode=0, highest=0;
for (int i = 1; i <= 100; i++)
if (data[i] > highest)
{
highest = data[i];
mode = i;
}
output << "the mode of the array is " << mode << ".\n";
}
//saves the mode in a text file
void writeOutput(ostream &output,int data[], int data_quantity)
{
ofstream out2File;
//asks for the file to be named
char saveas[20];
cout << "name the text file:";
cin.getline(saveas, 20);
out2File.open(saveas, ios::out);
displaymode(output, data, data_quantity);
}

New Topic/Question
Reply




MultiQuote




|