#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
using namespace std;
bool isPrime(int num);
int main()
{
int num;
ofstream outputFile;
outputFile.open("PrimeOut.txt");
// Checks to see if the file opens if (outputFile) { cout << "file opened" << endl; } else { cout << "The file cannot be opened" << endl; } // Input validation of user input number cout << "Enter a number between 1 and 100" << endl; cin >> num;
while (num < 1 && num > 100)
{
cout << "The number must be between 1 and 100" << endl;
}
if(isPrime(num) == true)
{
cout << num << endl;
}
return 0;
}
// Function for finding prime numbers
bool isPrime(int num)
{
bool valPrime;
for (int i = 2; i < num; i++)
{
valPrime = true;
}
return valPrime;
}