Trying to convert Psuedocode into C++

// START
// Declarations
// number id
// string ownerName
// string breed
// number age
// number weight
// number weeklyFee
//
// output "Please enter owner's ID: "
// input id
// output "Please enter owner's name: "
// input ownerName
// output "Please enter dog's breed (no space in input, use _ instead; For example Great_Dane): "
// input breed
// output "Please enter dog's age: "
// input age
// output "Please enter dog's weight: "
// input weight
// if (weight < 15) then
// weeklyFee = 55.00
// else if ((weight >= 15) and (weight <= 30)) then
// weeklyFee = 75.00
// else if ((weight > 30) and (weight <= 80)) then
// weeklyFee = 105.00
// else
// weeklyFee = 125.00
//
// output "Owner Name: ", ownerName
// output "Owner ID: ", id
// output "Dog Breed: ", breed
// output "Dog Age: ", age
// output "Dog Weight: ", weight
// output "Weekly Fee: ", "$",weeklyFee
// STOP
Last edited on
I don't get this, these seem more like instructions than code are you asking someone to make this program or asking how to make it?

As well why is there a comment marker (//) in front of all of them and not in code brackets either

the entirety of this post confuses me.
Last edited on

I don't get this, these seem more like instructions than code are you asking someone to make this program or asking how to make it?

As well why is there a comment marker (//) in front of all of them and not in code brackets either

the entirety of this post confuses me.

It's pseudo-code. I'm guessing OP wants us to check over it and help him convert it to C++.

Anyway, OP you need to check the validity of input. For example, a weight of -1 doesn't make sense.
Ah ok, good to know was unaware of what pseudo code was until now and a google search.
OP: you can all consider using a struct and it's ctor to instantiate Dog objects
Topic archived. No new replies allowed.