Answer to Question #40452 in C++ for gabe graham
2014-03-20T16:37:45-04:00
I have an infinite loop in this program. Please help
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <cctype>
using namespace std;
void PrintMenu(); //The Menu to be printed out
void IntSelect(int&, char); //To decide if a menu option was selected
void OpenFile(ifstream&, string&); //Opening a file
void countVow(int, char&, ifstream&);
void countCon(int num3, char ch3, ifstream& inFile, int ch2);//Counting vowels and consonants
int main()
{
int num1 = 0, num2, num3;
float fnum1, fnum2, fnum3;
string filename;
bool endLoop = false;
char ch = 'a', ch2, ch3;
ifstream inFile;
while (!endLoop)
{
PrintMenu();
IntSelect(num1, ch);
cout << num1 << endl;
cin.ignore (2000, '\n');
if (num1 == 1 || num1 == 2)
{
OpenFile(inFile, filename);
if (num1 == 1)
{
countVow(num2, ch2, inFile);
}
else;
countCon(num3, ch3, inFile, ch2);
}
else if (num1 == 0)
{
endLoop = true;
}
else
cout << string(10, '*') << " Invalid Se
0
Answer in progress...
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS !
Learn more about our help with Assignments:
C++
Comments
Leave a comment