Need help- Random Number Generator

Guys and gals I need help with this program. I've done alot of research trying to figure out the errors that keep popping up. Mainly on lines 249 and 250. If anyone has a solution it would be greatly appreciated. Thanks!

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

using namespace std;

int randomNumGenerator(int);
void menuOptions();

int funcOne(int, int); //1
int funcTwo(int, int); //2
long double funcThree(long double, int, int); //3
int funcFour(int, int); //4
long double funcFive(string, string, string, long double, int); //5
long double funcSix(string, long double, int); //6

int addTen(int, int);
void isPrime(int, int);

void validInput();
void cleanup();

int main()
{
int randNum, choice, choice2, divisor;
int currentNum;
int doubledNum;
long double reversedNum = 0;
long double poweredNum;
int sumOfNum = 0;
string firstToSecond, num1, num2;
string secondToThird;
long double twoDigitPowered, threeDigitPowered;
int add;

START:
cout << fixed << showpoint << setprecision(2) << endl;
cout << "The following random number is generated: ";

currentNum = randomNumGenerator(randNum);
cout << currentNum;
cout << "\n\n";

isPrime(currentNum, divisor);
menuOptions();
cin >> choice;
cout << "\n";

do
{
switch (choice)
{
case 1:
cout << "Doubled = " << funcOne(doubledNum, currentNum)
<< "\n\n";
currentNum = funcOne(doubledNum, currentNum);

addTen(currentNum, add);
currentNum = addTen(currentNum, add);
isPrime(currentNum, divisor);
break;
case 2:
cout << "Reversed Number = " << funcTwo(reversedNum, currentNum)
<< "\n\n";
currentNum = funcTwo(reversedNum, currentNum);

addTen(currentNum, add);
currentNum = addTen(currentNum, add);
isPrime(currentNum, divisor);
break;
case 3:

cout << "Raise to the power of 2, 3, or 4?: ";
cin >> choice2;
cout << "\n";
cout << funcThree(poweredNum, choice2, currentNum)
<< "\n\n";
if (choice2 == 2 || choice2 == 3 || choice2 == 4) //prevents bugging
currentNum = funcThree(poweredNum, choice2, currentNum);

addTen(currentNum, add);
currentNum = addTen(currentNum, add);
isPrime(currentNum, divisor);
break;
case 4:
cout << "Sum of the digits of the number = "
<< funcFour(sumOfNum, currentNum) << "\n\n";
currentNum = funcFour(sumOfNum, currentNum);

addTen(currentNum, add);
currentNum = addTen(currentNum, add);
isPrime(currentNum, divisor);
break;
case 5:
{ cout << "First Digit raised to Second Digit = "
<< funcFive(firstToSecond, num1, num2, twoDigitPowered, currentNum)
<< "\n\n";
currentNum = funcFive(firstToSecond, num1, num2, twoDigitPowered, currentNum);

addTen(currentNum, add);
currentNum = addTen(currentNum, add);
}
isPrime(currentNum, divisor);
break;
case 6:
{ cout << "First two digits raised to the third digit = "
<< funcSix(secondToThird, threeDigitPowered, currentNum)
<< "\n\n";
currentNum = funcSix(secondToThird, threeDigitPowered, currentNum);

addTen(currentNum, add);
currentNum = addTen(currentNum, add);
}
isPrime(currentNum, divisor);
break;
case -1:
goto START;
default:
cout << "Invalid Choice!\n\n" << "Current Number: "
<< currentNum << "\n";
}
cleanup();
menuOptions();
cin >> choice;
cout << "\n";
} while (choice != 0);
return 0;
}
void menuOptions()
{
cout << "Enter the corresponding number with what you want to do with this: \n";
cout << "1: Double the number.\n";
cout << "2: Reverse the digits of the number.\n";
cout << "3: Raise the number to the power of 2, 3, or 4.\n";
cout << "4: Sum the digits of the number.\n";
cout << "5: If the number is a two digit number, then raise the first digit to the power of the second digit.\n";
cout << "6: If the number is a three digit number and the last digit is less than or equal to 4, then raise the first two digits to the power of the last digit.\n";
cout << "-1: Reset Random Number.\n\n";
cout << "0: Terminate the program.\n\n";
cout << "Enter: ";
}

//Random Number Generator
int randomNumGenerator(int randNum)
{
while (randNum < 10 || randNum > 100)
{
srand(static_cast <unsigned int> (time(0)));
randNum = rand() % 100;
}
return randNum;
}

//Choice 1:
int funcOne(int doubledNum, int currentNum)
{
doubledNum = currentNum * 2;
return doubledNum;
}

//Choice 2:
int funcTwo(int reversedNum,int currentNum)
{
while (currentNum != 0.0)
{
int remainder = currentNum % 10;
reversedNum = reversedNum * 10 + remainder;
currentNum /= 10;
}
return reversedNum;
}

//Choice 3:
long double funcThree(long double poweredNum, int choice2, int currentNum)
{
switch (choice2)
{
case 2:
poweredNum = pow(currentNum, 2);
cout << currentNum << " squared = ";
break;
case 3:
poweredNum = pow(currentNum, 3);
cout << currentNum << " cubed = ";
break;
case 4:
poweredNum = pow(currentNum, 4);
cout << currentNum << " to the 4th power = ";
break;
default:
cout << "Not an option....";
return currentNum;
}
return poweredNum;
}

//Choice 4
int funcFour(long int sumOfNum, int currentNum)
{
while (currentNum > 0)
{
sumOfNum += currentNum % 10;
currentNum /= 10;
}
return sumOfNum;
}
//Choice 5
long double funcFive(string firstToSecond, string num1, string num2, long double twoDigitPowered, int currentNum)
{
firstToSecond = int(currentNum);
if (firstToSecond.length() != 2)
{
cout << "Not a 2-digit number\n\n";
cout << "Current number: ";
return currentNum;
}
else if (firstToSecond.length() == 2)
{
num1 = firstToSecond.substr(0, 1);
num2 = firstToSecond.substr(1, 1);
int numb1 = int(num1);
int numb2 = int(num2);
twoDigitPowered = pow(numb1, numb2);
}
return twoDigitPowered;

}

//Choice 6
long double funcSix(string secondToThird, long double threeDigitPowered, int currentNum)
{
secondToThird = int(currentNum);

unsigned long pos1 = secondToThird.length() - 1;
string substr = secondToThird.substr(pos1, 1);
if (secondToThird.length() != 3)
{
cout << "Not a 3-digit number\n\n";
cout << "Current number: ";
return currentNum;
}
else if (secondToThird.length() == 3 && secondToThird.length() <= 4)
{
string num1 = secondToThird.substr(0, 2);
string num2 = secondToThird.substr(2, 1);
int number1 = string num1;
int number2 = string num2;
threeDigitPowered = pow(number1, number2);
}
return threeDigitPowered;
}


//Add Ten
int addTen(int currentNum, int add)
{
if (currentNum < 10)
{
add = currentNum + 10;
cout << "Adding 10 = " << add << "\n\n";
currentNum = add;
}
return currentNum;
}

//Test Prime
void isPrime(int currentNum, int divisor)
{
if (currentNum >= 2)
{
for (divisor = 2; divisor <= currentNum / 2; divisor++)
if (currentNum % divisor == 0)
break;

if ((currentNum > 1) && (!(divisor <= currentNum / 2)))

cout << "The number " << currentNum
<< " is a prime number.\n\n";

else
cout << "The number " << currentNum
<< " is NOT a prime number.\n\n";
}

}

void cleanup()
{
cin.clear();
cin.ignore(INT_MAX, '\n');
//system("cls"); for Windows
}
You need to look at this

int number1 = string num1;
Topic archived. No new replies allowed.