Two political parties are contesting in the elections in the N number of states in the country ,each party wins some seats every year in each state.after the country elections are over we have the result of both the parties within an array.
the two parties considered equal win the same number of seats in the N states in any order otherwise they are unequal.
input :
1)it is an array of n integers depecting number of seats won by the party one in each state
2)it is an array of n integers depecting number of seats won by the party two in each state
3)An integers containing number of integers N
output:
equal : if the votes are equal
unequal: if the votes are unequal
invalid : if any party has negative number of votes.

Recommended Answers

All 2 Replies

Sorry, but we don't do your homework for you. Make an effort and post your code along with compiler and runtime errors here. Then we may be able to help critique your work, and make suggestions on how to fix it.

I think you firstly need to get more info to be able to understand the question.

The question (part 3 below) is poorly worded!

input :
1)it is an array of n integers depecting number of seats won by the party one in each state
2)it is an array of n integers depecting number of seats won by the party two in each state
3)An integers containing number of integers N

Does 3) mean to ...
firstly input the number of states into a variable called N (before inputting anything else) ?

If that is the case, you could use dynamic arrays of integers, each of size N, (or better to use vector< int > containers) to hold the number of seats won per state (index 0..(N-1)) in the N sized array (or vector) for each of the two competing parties.

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.