Hi, I have a simple code.
Code:
#include "stdafx.h"
#include <iostream>
using namespace std;
#include <cstdlib>
#include <ctime>
typedef int DataType;
void selectionSort( DataType theArray[], int n );
int indexOfLargest( const DataType theArray[], int size );
void mySwap( DataType& x, DataType& y );
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
void selectionSort( DataType theArray[], int n )
{
for (int last = n-1; last >= 1; --last)
{
int largest = indexOfLargest(theArray, last+1);
// Descending order.
mySwap(theArray[largest], theArray[n - last]);
} // end for
} // end selectionSort
int indexOfLargest( const DataType theArray[], int size )
{
int indexSoFar = 0; // index of largest item
// found so far
for (int currentIndex = 1; currentIndex < size; ++currentIndex)
{ // Invariant: theArray[indexSoFar] >=
// theArray[0..currentIndex-1]
if (theArray[currentIndex] > theArray[indexSoFar])
indexSoFar = currentIndex;
} // end for
return indexSoFar; // index of largest item
} // end indexOfLargest
void mySwap( DataType& x, DataType& y )
{
DataType temp = x;
x = y;
y = temp;
} // end swap
Compiler gives the error
d:\CD\myProjects\hw2Q4\hw2Q4.cpp(14): fatal error C1075: end of file found before the left brace '{' at 'd:\CD\myProjects\hw2Q4\hw2Q4.cpp(13)' was matched
There is no unmatched curly, any help would be appricated.