I'm writing a program that requires the user to enter several parameters for a simulation, but most of the time they will be entering the same values each time so I want there to be some sort of default value so they can just press enter and that value will be used.

the prompt will look something like this:

```
Enter Some Parameter [15]: 

```

so they can enter any number they want, or just press enter to use 15.

this is what I have so far

```
parameter = cin.get();
if(parameter == '\n')
    parameter = defaultValue;

```

it works, but only for the first digit and I also end up with a char cast to whatever type the parameter I'm working with is rather than the actual value that the user entered.

I would use

```
cin >> parameter;

```

but that doesn't let me use a default value in the way I described.

Does anyone know a way I can do this?