Super stumped with this assignment

I have no idea what else to do with this assignment. I am required to write a program that does this.
1. Create 2 text files on your drive F:\Lincoln.txt and F:\Kennedy.txt. (I did)
2. The program calls a funcation named: getChoices()
-The function displays two choices (A and B) and then prompts the user to enter a choice
- After the user's choice has been entered, the function displays two more choices (C and D) and then prompts the user to another choice
The function is void-returning, but the two choices are assigned variables declared in main()
3. The program should read oneo f the two files depending on the user's choice(A or B)
4. The program should then either write the speech to another file, or to the screen, depending on the user's choice C or D
5. Include a while loop that allos the user to run the program again.
If the program runs again, make sure to close all files before re-entering
if the program runs again, the screen clears
This is all I got
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include<iostream>
#include<fstream>
#include<iomanip>


char getChoice();


int main()
{
	char choice

	char getChoice

	return 0;
}

char getChoice();
{
	char choice;

	cout << "Which speech do you want to read? ";
	cout << "A. Read the file containing a speech by Lincoln.";
	cout << "B. Read the file containing a speech by Kennedy. ";
	
	cin >> choice;

	if (toupper(choice == 'A');
	{
		if (inFile.eof())
			break;
		inFile.get(character);
		outFile << character;


Obvious syntax errors aside...

The function is void-returning, but the two choices are assigned variables declared in main()

you need to have two variables in your main function. You also need to pass them in by pointer or reference to your getChoices function so that they can be set. According to the assignment, you shouldn't be doing anything in that function other than asking for two choices.

declaration for getChoices:
void getChoices(char& choice1, char& choice2).

3. The program should read oneo f the two files depending on the user's choice(A or B)

in your main function, test the value of the first choice and set a string variable to either lincoln.txt or kennedy.txt.

5. Include a while loop that allos the user to run the program again.

Put everything inside your main function inside a while loop, and at the end of the loop ask the user if they want to run the program again. get the response and test it, similar to the way you did with the choices.

Obviously, I'm not going to write the code for you, but this should get you started.



Thank you
Topic archived. No new replies allowed.