Okay, I need my output to be numbered.
I know the index code works but idk how to use that.

However, i also need to know how to do the if/else statement,
so that if the output is "0", then they dont get an index, they just recieve "0"

There's absolutely no context to your question, and as such, it's nonsensical.

Member Avatar for iamthwee

Presumably you mean you have something like:

string array[]={"boo","hoo","shoo"};

And you as you print it you want to print their indexes, i.e

[1] boo
[2] hoo
[3] shoo

In that case you can do

for (int i = 0; i < max; i++ )
{
cout << "[" << i+1 << "]" <<array <<endl;
}

But like narue said it is hard to tell what you mean.

Ok.

I have scores as my output,
and I want to descendingly number them down to 1.
Like as if I were ranking them.

However, if the score is "0",
I want them to be ranked as "0".

Make sense?

ok. How do I do the "if" statement for the people who received "0". I want to rank them as "0" instead of 1-20.

Member Avatar for iamthwee

Can you post your code so far plz.

>Make sense?
Yes, and I'm reasonably sure I've described how to do this to you before. Anyway, it makes more sense in this case to separate the scores that are zero into a separate list. This trivializes the rankings because you can just take the number of non-zero scores and rank them down from that number, then fill out the zero scores with "0".

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.