Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assignement: Write a C++ program which will read from file an unknown number of

ID: 3621613 • Letter: A

Question

Assignement:
Write a C++ program which will read from file an unknown number of words and display the word on the screen along with the number of each vowel in the word. For this exercise the vowels are a, e, i,o, u, y. Your program should loop until there are no words in the file. At the end of the program, your program should give the following statistics: the number of words read, the total number of
vowels in all words, and the average number of vowels in each word.

My problem:
So I use Visual Studio 2010, but to start off I don't even know how to importe the file to Visual Studio.
In other words, I don't know how to make the computer recognize wich file to open (for example I know I need to write ifstream.open ("MyFile"), but how do I realate the data file to Visual Studio)

Hopefully my question is clear!

Explanation / Answer

int main (void) { char a[60]; //I thought you may need a char to do this program ifstream inFile; // declarations inFile.open("Myfile.dat"); // open the file. I use "Myfile.dat" in my debugging while (inFile.eof()==false) // while not the end of file { inFile >>a; // get the data in the file cout