• Notice regarding image hosts and attachments. See here.

Very basic C++ question

Soldato
Joined
1 Jan 2007
Posts
3,186
Location
Exeter
Hi all,

I'm moving from Java to C++, and the minor differences between the two are really bugging me. I'm looking for code to read in an integer from a prompt, but for the prompt to have a string variable in it. For example, if I had a string variable 'Item' with a value "Cd-rom", I'd want the prompt to say "Enter the price of Cd-rom". So the code should look something like
Code:
ItemPrice = ReadIntPr("Enter the price of ," Item);
C++ doesn't like that (says the 'Item' is an extra parameter), and I'm probably missing something obvious, but I don't know what to google to find the answer.

Cheers,

MD
 
Back
Top Bottom