i wrote this module code but not sure if this is how you write a module. Is there anything i have missed??

int FirstModule(int section)
{
cout<< "Pick a number " <<endl;
cout<<endl;
cin>>number;

if (number == 1)
value = 1.00;


else if (number == 2)
value = 1.10;


else if (number == 3)
value = 1.20;


else if (number == 4)
value = 1.30;

else if (number == 5)
value = 1.40;

else if (number ==6)
value = 12345; //to close the program down
}

Recommended Answers

All 3 Replies

You're missing a return value (in the generic sense) which in this case happens to be the variable value.

Put in return value; between lines 26 and 27.

Not as critical, but you never use the parameter of the function for anything.

You have not used variable section.
variables number and value are not declared.
no return value.

variables number and value are not declared.

Thanks Rahul, I'm not sure how I zoned out on that one.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.