Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Can I get help? I don't know why this doesn't work! c++

0 votes
asked Oct 23, 2019 by Coconut (160 points)

// Lost Fortune

// A personalized adventure

#include <iostream>

#include <string>

using namespace std;

int main()

{

    //define constant

    const int GOLD_PIECES = 900

    //declare variables

    string leader  //last name of user

    int adventurers    //number of adventurers that begin journey

    int killed     //number of adventurers killed

    //get values

    cout << "\tWelcome to Lost Fortune" << endl << endl;

    cout << "Please enter the following for a personalized adventure.";

    cout << endl << endl;

    cout << "Enter your last name: ";

    cin >> leader;

    cout << "Enter the amount of adventurers you want to have: ";

    cin >> adventurers;

    cout << "Enter the amount of adventurers you want to have killed, but it has to be less than the adventurers you have: ";

    cin >> killed;

    //calculate new values

    int survivors = adventurers - killed;

    int extraGoldPieces = GOLD_PIECES % survivors;

    //tells the story

    cout << endl;

    cout << "The brave " << leader << " led a group of " << adventurers;

    cout << " adventurers on a quest." << endl;

    cout << "They fought a band of ogres and lost " << killed << "... only ";

    cout << survivors << " survived." << endl;

    cout << "The party was about to give up when they stumbled upon a" << endl;

    cout << "buried fortune of " << GOLD_PIECES << " gold pieces. ";

    cout << "They split the loot and" << endl;

    cout << leader << " kept the extra " << extraGoldPieces << " gold piece(s)";

    cout << "to keep things fair." << endl;

    return 0;

}

1 Answer

+1 vote
answered Oct 24, 2019 by anonymous
selected Oct 25, 2019 by Coconut
 
Best answer
when you declare your variables leader, adventurers, killed and your constant you have to put ; at the end of the line.
commented Oct 25, 2019 by Coconut (160 points)
Thank you so much, I put it in almost every other but I guess I forgot some of them.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...