/* 
 * Implementation file for exam2. This is the file you will actually be working
 * on. This is the ONLY file you will be turning in. Do not make any changes to
 * the function headers!
 * 
 * Please see the header file for explanations on what the functions should do.
 * Run this file together with the main file to see if your implementations are
 * correct.
 * 
 * Remember: NONE of your functions should have any screen input/output (do not
 * use cin / cout). Instead, use the parameters given to get your input and
 * return your output!
 */

/*
 * Your Name:
 */

#include <string>
#include <cstring>
#include <cmath>
#include "exam2impl.h"
using namespace std;

 
char numberToLetterGrade(int grade)
{
  char letterGrade;

  if (grade>=90) letterGrade='A';
  else if (grade >= 80) letterGrade='B';
  else if (grade >= 70) letterGrade='C';
  else letterGrade = 'F';

  return letterGrade;
}
 
void UpPeRlOwEr (char c[]) 
{
  int i;
  for (i=0;c[i]!='\0';i++)
    if (i%2==0) c[i] = toupper(c[i]);
    else c[i] = tolower(c[i]);
}
 
string UpPeRlOwEr (string s)
{
  int i;
  for (i=0;i<s.length();i++)
    if (i%2==0) s[i] = toupper(s[i]);
    else s[i] = tolower(s[i]);
  return s;
}
 
int elementForIndex(int *a, int index)
{
	return a[index];
}
 
int coordinateForIndex(coordinate *c, int index)
{
	if (index==1) return c->x;
	if (index==2) return c->y;
	if (index==3) return c->z;
}

int *allocateDynamicArrayAndFillWithNumbers(int count)
{
	int *a;
	a = new int[count];
	int i;
	for (i=0;i<count;i++) 
		a[i] = i+1;
	return a;
}
 
 
 
