in reply to Re^2: seeking advice on loops
in thread seeking advice on loops
Personally I like to use psuedo-code - something that is half-way between English (or whatever your native tongue) and code - and then gradually replace the pseudo-code with real code. Here's how I'd start with your assignment:
user_wants_to_continue is 'yes'
while ( user_wants_to_continue is not 'no' ) {
prompt for and get product_name
prompt for and get quantity
prompt for and get price
store product_name in array
store product_name, quantity, price in hash
prompt for and get user_wants_to_continue
}
|
|---|