- #1
OSalcido
- 66
- 0
Homework Statement
I'm trying to read a string from cin. When it hits the "cin >> strWord" statement, I get the following error message: Segementation fault (core dumped). The input file is named "data4nine". I'm really not sure what a segmentation fault is and why I'm getting it
The Attempt at a Solution
Code:
while (!cin.eof())
{
cin >> strWord;
intWords++;
cntVowsCons(strWord, intVowels, intConsonants);
strFormatted = FormatWord(strWord);
lenWords += strWord.length();
lenFormatted += strFormatted.length();
if(strFormatted.length() % 2 != 0)
SwapMidChar(strFormatted);
if(istenth(intWords, tenth))
cout << strFormatted << endl;
else
cout << strFormatted;
}