I am not a programmer. I took a class a year ago and recently decided to modify a hangman game I made. Instead of making a game, I am trying to input a file with several thousand words and then test them each individually to see how many guesses it takes the c++ program to get the word. As my code is now when I try to run it it runs a floating point exception. I believe this is because of my rand()% (When I comment out index-- I instead get an error saying its trying to erase on an index higher than the highest of the string. But the floating point error is fixed). I don't see why there should be a floating point exception (core dumped). Any help is appreciated. And I have not finished the program, so if anyone sees good improvements or anything I would appreciate that as well.
#include <iostream>
#include <string>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <fstream>
using namespace std;
int guesscount(string u, int length);
int main()
{
srand(time(0));
string list[109582], guessed[26];
string word, wordout, rando;
int wordlength;
int guesscount(string u, int length)
{
int count=0;
string alpha="abcdefghijklmnopqrstuvwxyz";
int j=0, rando=0, index=26;
while(j<length)
{
rando=rand()%index;