Array Allocation

Pages: 12
@keskiverto Thanks for the reply.

1
2
3
4
for(i=0; i<limit; i++)
	{
		count[i]=0;
	}


is this how i assign array count ?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
   cout<<"Enter the gift number for the following people: "<<endl;
    for(currentperson=0; currentperson<limit; currentperson++) 
	{
        cout<<name[currentperson]<<" : ";
        cin>>input;
        int index = input - 1;
        if(index<0 || index>4) 
		{
            cout<<"Invalid Range"<<endl;
        }
        else if(available[index])
		{
            available[index]=false;
            count[currentperson]=index;
        } 
		else 
		{
            cout<<"The gift has already given to "<<name[index]<<endl;
            i--;
            currentperson--;
        }
    }


I have replace the "i" with currentperson.
Topic archived. No new replies allowed.
Pages: 12