need help with an assignment for my class

I am new to C++ and need help with a assignment.

Create an interactive fiction story application in C++
You will get to try out your requirements gathering, and design skills. Here is a valuable link to understand interactive fiction from a user perspective. It is important to try to pick a category and try a few of the interactive fiction games at this link to understand the requirements for this assignment. This is an Interactive Fiction assignment, not an adlib assignment. Up until now, we have not done anything like and Interactive Fiction Assignment. Try out several interactive fiction simulations below and have fun!

http://textadventures.co.uk/

Assignment Objectives:
Create an Interactive Fiction game.
Create a C++ program that uses more than one function.
Control all your functions through the main function.
Pass and return parameters to your functions.
Your program must do something and be an interactive fiction game, it must not just demo functions.
Have fun!
Pro Tips
Read Chapter 5 in your text on functions.
Study the Interactive Fiction Modules in this week's modules.
Come to class as we will be going over the skills you will need to complete this assignment.
Put a lot into this assignment, the more functions you write on this assignment, the less code you will have to write on the final project.
Requirements
Create a new console project.
Create an Interactive Fiction game with a great user experience.
Your program must do something and be an interactive fiction game or simulation, it must not just demo functions.
Add at least one function that takes a string or an int.
Add at least one function that returns a string or an int.
Add at least 5 functions overall in addition to main.
Your main function should control all the other functions.
Over comment your source code file (.CPP).
Take a screenshot of the program working.

i do not want someone to do it for me i just am looking for some guidance. my teacher doesnt really teach and i have never done any of this

What do you have written so far? Also, what have you covered in your class so far? Do you generally understand the prompt, or is there a particular part that you don't understand?

-Albatross
1. The key to this to get a start and into the future is to play a couple of the games.
Say 10 minutes on a couple of them and get an idea (note them down) on what sort of functions you'll eventually have to write using C++
A menu, and an insert your name function would be 2 to start with.

2. Read chapter 5.

3. Go to the skills class with your findings on the above so you can compare skills with what others say.

4. The rest - choosing a scanario and coding comes after that and probably after the skills class.

Above all, read the question often, and number the lines/underline key points her and there.

Goo luck ... Edit: Good luck is more to the point :)
Last edited on
You can code your game as a state machine. The state is your current location, your possessions, health, etc. The user types a sentence (verb and optional object) and the code does something depending on the state, verb and object.

Now here's the interesting part, your code does NOT need to know about each state and verb. You could put that in a data file and have your program read and act on the data file. The file describes each location and what happens for each of the legal verbs at that location.

This gets you 90% of the way there, but there will probably be special cases where something happens in your game that is beyond the scope of the state machine. For those things, you'll want your state machine code to check if the condition exists and execute the special code.

Work on getting the state machine and data file functioning with 2-3 rooms, perhaps 4 verbs, a few possible possessions and 1 example of special case code. Once you have that working, most of the changes in the game will be to the data file.
We also wrote a similar work, called a coursework. Here, it is better to go straight to the professionals, so as not to make a ton of mistakes there. For example, I'm very weak in writing and it's still good that my friends helped me and told me to look at the rating of companies at https://pickthewriter.com/ Pick The Writer and then contact me. Because many of the companies do not work very well, plagiarize and so on. This cannot be allowed. Because be sure to think about it and get acquainted. Good luck, I hope I was able to help with this difficult problem. I found a company here and was helped to solve such a problem.
Last edited on
How much is done at the moment? To understand what part to finish.
@Hison, who are you asking?
#include <iostream>
#include <string>

using namespace std;

string askText(string prompt);
int askNumber(string prompt);
void tellStory(string teamName, string noun, int age, string mascot, string verb);
int main()
{
cout << "Welcome to Legends of the Hidden Temple \n\n";
cout << "Lets get to know our teams\n";

string teamName = askText("Please tell us your team name: ");
string noun = askText("Please tell us how you and your team mate met:");
int number = askNumber("How old are you and your teammate:");
string mascot = askText("Please tell us what your team animal is:");
string verb = askText("You have been captured");
tellStory(teamName, noun, number, mascot, verb);
return 0;
string askText(string prompt)
{
string text;
cout << prompt;
cin >> text;
return text;
}
int askNumber(string prompt)
{
int num;
cout << prompt;
cin >> num;
return num;
}
void tellStory(string teamName, noun, number, mascot, verb)
{
cout << "\nWelcome to legends of the Hidden Temple\n";
cout << "This is a game where if you answer a question correctly you move on if wrong lose a life.";
cout << "Lets meet our first team";

}
}


this is what i have so far.
Looks like you might be getting somewhere, take a look at these fixups so far, get back of you like if you get stuck. I haven't checked it against the assignment, I just answered the question it throws up.

One hint for the future is using the getline() function for some of the string values. That way if the name contains blanks ( 2 or more words) getline() allows it while just an ordinary cin bombs out.

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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <iostream>
#include <string>

using namespace std;

string askText(string prompt);
int askNumber(string prompt);
void tellStory(string teamName, string noun, int age, string mascot, string verb);

int main()
{
    cout << "Welcome to Legends of the Hidden Temple \n\n";
    cout << "Lets get to know our teams\n";
    
    string teamName = askText("Please tell us your team name: ");
    string noun = askText("Please tell us how you and your team mate met:");
    int number = askNumber("How old are you and your teammate:");
    string mascot = askText("Please tell us what your team animal is:");
    string verb = askText("You have been captured");
    tellStory(teamName, noun, number, mascot, verb);
    
    return 0;
} // <-- FUNCTIONS GO OUTSIDE main()


string askText(string prompt)
{
    string text;
    cout << prompt;
    cin >> text;
    return text;
}

int askNumber(string prompt)
{
    int num;
    cout << prompt;
    cin >> num;
    return num;
}

void tellStory(string teamName, string noun, int age, string mascot, string verb) // <-- ***
{
    cout << "Welcome to legends of the Hidden Temple\n";
    cout << "This is a game where if you answer a question correctly you move on if wrong lose a life.";
    cout << "Lets meet our first team";
    
    cout << "My name is: " << teamName << '\n'; // <-- ***
    
    // *** IF YOU DON'T USE THE PASSED PARAMETERS LIKE teamName etc, THEN LEAVE
    // LIST BLANK
    
}


Welcome to Legends of the Hidden Temple 

Lets get to know our teams
Please tell us your team name: MyTeam
Please tell us how you and your team mate met:party
How old are you and your teammate:209
Please tell us what your team animal is:pig
You have been captured
PS It's a good move to properly indent your code, and also to tag your code using the <> in the toolbox on the right - go back and edit your post, select all the code and then press <>
Registered users can post here. Sign in or register to post.