prototyped function not called (was a variable definition intended?)

my program is supposed to produced a multiple choice test. it works for the first four questions but then it crashes after that. it also produces a warning that the prototyped function not called (was a variable definition intended?)Can someone please explain why it is crashing after 4 questions. i think it has to do with my repeats function but i don't know how to fix it


//Julia Rider and Bryant Goodenough
//Assignment #5
//This program generates a multiple choice quiz using arrays, functions and random numbers

#include <fstream>
#include <string>
#include <iostream>
#include <iomanip>
#include <ctime>
#include <cstdlib>

using namespace std;
ifstream fin;

int main ()

{
int i=0;
int l=0;

fin.open ("terms.txt"); //if it fails to open file, output "open error"
if (fin.fail())
{
cout << "Open Error";
//exit (1);
}

const int Size=10;
std :: string line1;
string line2;
string randomterm;
string terms [Size];
string def [Size];
string choices [4] = { " ", " ", " ", " " };
string answer [Size];
string response [Size];
string letters [4] = {"a", "b", "c", "d"};
string correctLetters [Size];
string repeats (string &choices, string &answer, string&terms, int &i);
int let [Size]={};
int an [Size];

getline(fin,line1);
getline(fin,line2);

while (!fin.fail()) {


terms [i] =line1;
def[i] = line2;


getline(fin,line1);
getline(fin,line2);
i++;
}

int rad= 0;


for (int i = 0; i< 10 ; i++)
{
answer [i] = terms [i];
cout << def [i] << endl; //displaying question
choices [0] = terms [rand ()%10]; //generating random terms
choices [1] = terms [rand ()%10];
choices [2] = terms [rand ()%10];
choices [3] = terms [rand ()%10];


string repeats (choices [i]);

choices [ an [i] = rand ()%4 ] = answer [i]; //placing the answer in a random position

for (int j=0; j<4; j++) //displays the choices
{
cout << letters [j] << ")" << choices [j] << " ";

}


cout << endl << "Enter your answer (a,b,c,d): " << endl; //asking for user input
cin >> response [i];

while ( response [i] != "a" && response [i] != "b" && response [i] != "c" && response [i] != "d" )
{
cout << endl << "Enter your answer (a,b,c,d): "; //checking to make sure the user correctly answers either a,b,c or d
cin >> response [i];
}


if (response [i] == "a" ) { let [i]= 0;}
if (response [i] == "b" ) { let [i]= 1;}
if (response [i] == "c" ) { let [i]= 2;}
if (response [i] == "d" ) { let [i]= 3;}


if (let [i] == an [i] ) {
l++ ; //if the answer is correct display correct, if not display incorrect
cout << "Correct!" << endl;
}
else
{cout << "Incorrect." << endl;}
cout << endl;
}

cout << "You scored " <<l<< " terms correctly." << endl;


system("pause");
return 0;
}

string repeats (string &choices, string &answer, string&terms, int &i) {
while (choices [0] == choices [1] || choices [0] == choices [2] || // checking to make sure that there are no repeated answers
choices [0] == choices [3] || choices [1] == choices [2] ||
choices [1] == choices [3] || choices [2] == choices [3] ||
choices [0] == answer [i] || choices [1] == answer [i] ||
choices [2] == answer [i] || choices [3] == answer [i]

//checking to make sure that the answer is not already displayed in the choices
) {
choices [ rand () %4] = terms [rand () %10]; //generating new random term if there are repeats
}
return choices;}
Topic archived. No new replies allowed.