Need help declaring a variable name

In this code i want to be able to input rusty knife or any other name i wish into the WeaponName variable and have it print out on the screen. I also do not want the person using the program to be able to change the name of their weapon and was wondering how i would go about doing this.

1
2
3
4
5
6
7
8
9
10
11
12
#include <cstdlib>
#include <iostream>
#include <string>

using namespace std;

int main()
{
    string WeaponName;
    cout << "You find a rusty knife on the ground and pick it up." << endl;
    cout << "You now have a " << WeaponName << "equipped" << endl;
}
er... unless I'm misunderstanding....

 
string WeaponName = "rusty knife";
yup that fixed i feel dumb now lol i spent the past hour trying to figure that out
Topic archived. No new replies allowed.