Trying to write a program that opens a file

I missed class on the day we learned this and I can't seem to figure out how to do this... I read my textbook over and over! please help!


Write a C++ program that asks the user to enter the name of the file he wishes to open. The file will contain 2 odd numbers in ascending order (no need to validate). The program should read the two numbers, open a new file called Tree.txt, and display a tree pattern based on the two numbers. For instance, if the numbers read in were 3 and 7, the following should be printed into the output file:
*
* * *
*
* * *
* * * * *
*
* * *
* * * * *
* * * * * * *

- The top-most triangle has a base = first number
- The bottom-most triangle has a base = last number
- The triangle bases are incremented by 2 each time.
- Use nested loops to print the triangle patterns. Use cout<<"*"; to display the asterisks.
Topic archived. No new replies allowed.