Hi,
im trying to work out how to obtain the position in an array that an indivudal character(or number) is located.
For example:
Ive managed to count how many 'x''s there are in the array but I want to be able to work out the postition in the array they are (ie 0, 5, 12, 556! etc...)Code:char formula[100]; //this is array I want to search int counter=0; int x = 0; cout<<"enter linear forumla: "; cin>>formula; cout<<"forumla entered: "<<formula<<"\n\n"; //Testing for x variables for(counter=0;counter<sizeof(formula);counter++) { if(formula[counter] == 'x' ) x++; } cout<<"\n"<<x;
I hope you understand what I mean