I did most of this program, but it has a couple of problems. Every time I get to the end of the program the Highest numerator is always five regardless of what I entered. The next problem is the Highest denominator entered does not show up. Instead a lot of numbers show up. The program also allows me to enter a 0 for the denominator. The last thing is I don't know if the positions are right.

It is suppose to have a main() function that declares an array of 5 Fraction objects. Prompt the user for values for each field of each Fraction. It is not suppose allow the user to enter a value of 0 for the denominator of any Fraction; for each Fraction, continue to prompt the user for a denominator value until a non-zero value is entered. It is also suppose to Display the numerator and denominator for each of the five Fraction objects. Then display the value of and array position of the highest numerator, and the value of and array position of the highest denominator.
Please help me!
Thanks

Recommended Answers

All 2 Replies

Remove unnecessary parts (ie. unrelated to your problem) from the program and then post it here. Many people are unwilling to download attachments because it's an inconvenience when most of the time we can tell you what the problem is at a glance.

One thing that I did was change <iostream.h> to <iostream> took out a lot of errors. With this I included using namespace std; before you entered the main() function. Then when I tried to compile it said no new line in your class 'Fraction' so I put cout << "\n"; in and it compiled and worked. but when I compiled it there were some bugs in it, that I haven't looked for yet. I hope that helpped a little.

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.